On alignment

Andreas Schwab schwab@suse.de
Tue Apr 22 13:15:00 GMT 2003


Andrew Haley <aph@redhat.com> writes:

|> WHat I still cannot understand is why a struct that contains a double
|> is 4-aligned on x86, but a double is 8-aligned.  This means that you
|> cannot infer the alignment of a struct from the alignment of its
|> members.  Is this really part of the multi-vendor ABI?

The alignment of a struct member determines the amount of padding that
must be inserted, thus it is important to maintain the exact alignment
requirements of the ABI.  For simple variables there is no such
requirement, there is never a problem when a standalone variable is
overaligned.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Gcc mailing list