Assuming that a program is running on a system with UTF-16 encoding character set.
So according to The C++ Programming Language - 4th, page 150: "A char can hold a character of the machine’s character set." → I think that a char variable will have the size is 2-bytes.
But according to ISO/IEC 14882:2014: "sizeof(char), sizeof(signed char) and sizeof(unsigned char) are 1". or The C++ Programming Language - 4th, page 149: "[...], so by definition the size of a char is 1" → It is fixed with size is 1.
Question: Is there a conflict between these statements above or is the "sizeof(char) = 1" just a default (definition) value and will be implementation-defined depends on each system?
Aucun commentaire:
Enregistrer un commentaire