Author mark.dickinson
Recipients Alexander.Belopolsky, MrJean1, ajaksu2, barry, benjamin.peterson, inducer, mark.dickinson, meador.inge, noufal, pitrou, teoliphant
Date 2010-05-20.18:50:02
SpamBayes Score 0.000131048
Marked as misclassified No
Message-id <1274381405.97.0.263467884633.issue3132@psf.upfronthosting.co.za>
In-reply-to
Content
> The C99 standard does not specify what the behavior should be.

Right;  it's down to the platform ABI.

I think the least common multiple of the alignment requirements of the struct members is the way to go, though.  It's difficult to imagine an ABI for which this lcm isn't the same thing as the largest struct member alignment, but I don't want to categorically say that such ABIs don't exist.

Here's a snippet from the gcc manual [1]:

"Note that the alignment of any given struct or union type is required by the ISO C standard to be at least a perfect multiple of the lowest common multiple of the alignments of all of the members of the struct or union in question."

I'm not sure I could identify the precise pieces of the standard that imply that requirement, though.

[1] http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Type-Attributes.html#Type-Attributes
History
Date User Action Args
2010-05-20 18:50:06mark.dickinsonsetrecipients: + mark.dickinson, barry, teoliphant, pitrou, inducer, ajaksu2, MrJean1, benjamin.peterson, noufal, meador.inge, Alexander.Belopolsky
2010-05-20 18:50:05mark.dickinsonsetmessageid: <1274381405.97.0.263467884633.issue3132@psf.upfronthosting.co.za>
2010-05-20 18:50:03mark.dickinsonlinkissue3132 messages
2010-05-20 18:50:03mark.dickinsoncreate