I am interested to know about uint32_t type alignment on 64-bit platforms. The spectrum says uint32_t should be exactly the given bit width, which really seems to be:
> printf("sizeof(uint32_t): %zd\n", sizeof(uint32_t)); sizeof(uint32_t): 4
But then I have a structure:
typedef struct A { uint32_t a; uint32_t b; } A;
But what is surprising:
> printf("sizeof(A): %zd\n", sizeof(A)); sizeof(A): 16
Is uint32_t 8-byte aligned for any reason? Is this really an 8 byte type under it?
source share