That is what sizeof(bool) outputs. That 1 byte is based on the CHAR_BIT macro which the standard requires is atleast 8 bits. It could also be as much as 32 bits, apparently. Silly C++
That's the C remnant from a time, where a processor word was not guaranteed to be 8-bit (aligned). Also: CHAR_BIT is atleast 7 bit as a char is required to fit the ASCII table. The 8'th bit is already optional (but guaranteed on all modern systems with 8-bit aligned memory and 32/64 bit cpu words)
View all comments
Show parent comment
3
u/Usual_Office_1740 15d ago edited 15d ago
That is what sizeof(bool) outputs. That 1 byte is based on the CHAR_BIT macro which the standard requires is atleast 8 bits. It could also be as much as 32 bits, apparently. Silly C++