I have a structure
struct abc{
int32_t status;
union A;
};
sizeof(int32_t) is 4. sizeof(union A) is 24.
I was expecting that status
should get aligned and take total 8 bytes (considering 64 bit compiler) but the size of structure abc is coming as 28 and not 32. Can someone explain why ? Note it is not pragma packed.
union A{
int8_t a;
struct b;
struct c;
}
struct b
{
int8_t a;
int32_t b2;
int32_t b3;
int32_t b4;
}
struct c
{
struct b;
int32_t c1;
int32_t c2;
}