Hacker News new | ask | show | jobs
by flohofwoe 326 days ago
Not unless you're stuck in the 90s ;) These sizes have all been standardized to 1 byte since C99.
2 comments

Not the sizes, the alignments.
Same thing in C though, the primitive types have the same alignment as their size.
That 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

Also, "sizeof(bool) is not required to be 1."

I've seen register-sized bool on systems without free conversion between register sizes.