3 ms·
And bool may be 4, and char may be 2(m68k)!
by bobmcnamara 1y ago
And bool may be 4, and char may be 2(m68k)!
- flohofwoe 1y agoNot unless you're stuck in the 90s ;) These sizes have all been standardized to 1 byte since C99.
- bobmcnamara 1y agoNot the sizes, the alignments.
- flohofwoe 1y agoSame thing in C though, the primitive types have the same alignment as their size.
- bobmcnamara 1y agoThat is true on some systems, but not a portable assumption by any means. Edit: st7: sizeof(uint32_t)=4, aligned(uint32_t)=1 msp430: sizeof(int)=2, alignof(int)= 1 Real old ARM: sizeof(double)=8, alignof(double)=4 OG M68k sizeof(char)=1, but struct align(char)=2
- bobmcnamara 1y agoAlso, "sizeof(bool) is not required to be 1." I've seen register-sized bool on systems without free conversion between register sizes.