3 ms·
I think it's just that you don't need to be clever when storage is cheap. A boolean in C is the same size as an int. In the past you would pack this into bitf
by aidenn0 6y ago
I think it's just that you don't need to be clever when storage is cheap. A boolean in C is the same size as an int. In the past you would pack this into bitfields, but why bother any more? Right there that's a 32x or 64x blowup on space and it's the first thing I thought of.
- cbarrick 6y agoIsn't `sizeof(bool) == 1` on most C99 compilers? Having bool be 4 or 8 bytes is ridiculous.
- deleted 6y ago[deleted]
- aidenn0 6y agoJust checked, and you are right. I'm probably thinking of the pre c99 days where a boolean was often implemented as an enum. (Perhaps unsurprisingly) the literals "true" and "false" appear to be of integer size in the compilers I tried on c99, implying they are implemented as "1" and "0" and not "'\001'" and "'\000'"