[issue3132] implement PEP 3118 struct changes

Mark Dickinson report at bugs.python.org
Thu May 20 20:50:05 CEST 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

> 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

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3132>
_______________________________________


More information about the Python-bugs-list mailing list