Solaris core dump with McMillan Installer

Martin von Loewis loewis at informatik.hu-berlin.de
Thu Oct 25 11:28:59 EDT 2001


> > So does anyone know what the worst case alignment rule is for
> > structs?

If you are talking about C structs, you should be aware that the
layout varies from system to system; in particular, the internal
padding may change.

So if you have a single worst-case alignment, the structure fields may
still end up on the wrong positions on some systems.

"Thomas Heller" <thomas.heller at ion-tof.com> writes:
> Isn't this specified in the C-standard ?
> (That's what I heard, not that I would have one...)

The C standard doesn't explicitly mandate alignment for a structure;
it just mandates that all fields are aligned. In turn, that normally
means that a structure must be aligned in the same way as the field
with the largest alignment. That means that the worst-case alignment
for a structure is the same as the worst alignment for any type.

On most systems requiring primitive types to be aligned, the alignment
is 8 if they support a "double" type. On Ultra-SPARC, the worst-case
alignment is 16, for the "long double" type.

Regards,
Martin




More information about the Python-list mailing list