Bloated Struct Problem

Ian Lance Taylor iant@google.com
Sat Jun 6 00:31:00 GMT 2009


". ." <pkejjy@gmail.com> writes:

> (In other words, I think the default for x86(-64) should be packed,
> but I'll leave it to others to have that flame war.)

The ABI can not change.  Changing that now would prevent linking object
files compiler by different compilers together safely, as they would use
different offsets for accessing struct fields.

In any case, different programs have different tradeoffs here.  Some
programs prefer the faster access of aligned fields, some programs
prefer the reduced memory usage of packed fiels.  No single default can
be satisfactory for everybody, but nevertheless there must be a default.

Ian



More information about the Gcc-help mailing list