wolf-revo-cats wolf-revo-cats - 3 months ago 25
C Question

What counts as character type in C11?

What actually belongs to the "character type" in C11 — besides

char
of course?

To be more precise, the special exceptions for the character type (for example that any object can be accessed by an lvalue expression of character type — see §6.5/7 in C11 standard), to which concrete types do they apply? They seem to apply to
uint8_t
and
int8_t
from
stdint.h
, but is this guaranteed? On the other hand gcc doesn't regard
char16_t
from
uchar.h
as a "character type".

Answer

Only char, signed char and unsigned char¹.

The types uint8_t, int8_t, char16_t, or any type in the form intN_t or charN_t, may or may not be synonyms for a character type.


¹ (Quoted from: ISO/IEC 9899:201x 6.2.5 Types 15):

The three types char, signed char, and unsigned char are collectively called the character types.

Comments