Uh, how sure are we about this?
I found this example
struct Struct1 {
double a1;
char a2;
};
Apparently this is supposed to have size 16, because "the member with the largest alignment requirement is a1
; therefore, a2
is padded with 7 bytes". If we just set double
to have alignment 4, we'll give this struct size 12.