Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What counts as character type in C11?

Tags:

c

char

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".

like image 350
viuser Avatar asked Aug 08 '16 08:08

viuser


1 Answers

Only char, signed char and unsigned char1.

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.


1(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.

like image 72
2501 Avatar answered Oct 16 '22 23:10

2501