Is sizeof(bool) defined in the C++ language standard?

sizeof(bool) is implementation defined, and the standard puts notable emphasis on this fact. ยง5.3.3/1, abridged: sizeof(char), sizeof(signed char) and sizeof(unsigned char) are 1; the result of sizeof applied to any other fundamental type is implementation-defined. [Note: in particular, sizeof(bool) and sizeof(wchar_t) are implementation-defined.69)] Footnote 69): sizeof(bool) is not required to be 1.

Undefined, unspecified and implementation-defined behavior

Undefined behavior is one of those aspects of the C and C++ language that can be surprising to programmers coming from other languages (other languages try to hide it better). Basically, it is possible to write C++ programs that do not behave in a predictable way, even though many C++ compilers will not report any … Read more