What is the default structure packing using cl/gcc/clang?

2.7k views Asked by At

On msdn for cl compiler option /Zp, it is mentioned that "Packs structures on 8-byte boundaries (default)." Does that mean that if there a data type of size > 8 bytes, by default (no compiler option or pragma pack) it would not be naturally aligned and rather will have 8 byte alignment. If yes, is that case with GCC/clang?

I checked on GCC, using -fpack-structand __uint128_t, that it does not have any such default. For example sizeof(tStruct) is 32 and 24:

struct tStruct {
uint64_t    a;
__uint128_t b;
};

I am not able to check the same on windows as it does not provide any data type > 8 bytes.

0

There are 0 answers