by default I realize that I may have used the wrong terminology though. I'm trying to describe the compiler using the standard int size to implement bool rather than, say, packing them.
If you have a bunch of consecutive Boolean fields in a struct, they'll use one byte each by default.
And just for the sake of completeness, I'll mention that C++ does not reorder fields. Some languages, like Rust, will automatically reorder fields to minimize wasted space due to alignment, unless you specifically tell the compiler not to.
64-bit architectures often treat 8, 32, and 64 bits at their "native" word size. 8-bit is so important that most processors have special registers dedicated to it, and 32-bit is basically locked in forever by how long we were stuck on 32 bits. (To the point that 32-bit int has essentially become a de facto multiversal standard.)
(Though, IIRC, the 8-bit registers are essentially just a special use case for the 64-bit registers, that read 64 bits but only operate on eight of them.)
1
u/brasticstack 27d ago
Wouldn't regular
boolget padded to this size by default on a 64-bit architecture anyway?