Bloated Struct Problem

Robert William Fuller hydrologiccycle@gmail.com
Sat Jun 6 03:12:00 GMT 2009


Ian Lance Taylor wrote:
> ". ." <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.

Of course if the code is C++, there is no reason to worry about linking
object files from different compilers.  It is currently a pipe dream.



More information about the Gcc-help mailing list