Talk:c/language/character constant
[edit] example fixes
I wish to understand a little more about the three fixes.
1) "'猫' etc are not "multibyte characters"." I hesitated using the term "multicharacter constant" since it does not appear in the C11 standard. I see now that the term frequently appears in stackoverflow when discussing 'abcd'. Rereading the definition of "multibyte character" made me realize that '猫' etc must not be from an extended character set. Do I have that right? '猫' etc are not members of an extended character set as defined by C?
- 猫 is a character from the extended charset: it's even allowed in identifiers per Annex D (and it works in clang), but it is not encoded as a single byte, so the result of putting it in single quotes is implementation-defined (and, unlike 'abcd', not de-facto portable). --Cubbi (talk) 05:41, 15 November 2016 (PST)
2) The fix "don't ignore Unicode" means don't exclude uchar.h from the example. Correct?
- Yes, I meant char16_t and char32_t (the Unicode character types). Unlike implementation-defined behaviors, these actually demonstrate standard behavior. --Cubbi (talk) 05:41, 15 November 2016 (PST)
3) The fix "byte representation of an int does not illustrate any part of this page" prompts me to ask: Why is it acceptable to show byte representation in the string literal example but not here?
- ints and character arrays are different types. Object representation of int reflects platform endianness and has nothing to do with character encoding. Object representation of a char array represents character encoding (in particular, the difference between UTF-16le and UTF-16be), and has nothing to do with platform endianness. --Cubbi (talk) 05:41, 15 November 2016 (PST)
I carefully studied the string literal example before writing my character constant example. Newatthis (talk) 05:13, 15 November 2016 (PST)