Next: Weak Pragmas, Previous: Symbol-Renaming Pragmas, Up: Pragmas
For compatibility with Win32, GCC supports a set of #pragma
directives which change the maximum alignment of members of structures
(other than zero-width bitfields), unions, and classes subsequently
defined. The n value below always is required to be a small power
of two and specifies the new maximum alignment in bytes.
#pragma pack(
n)
pushes the current maximum alignment setting
onto an internal stack and then sets the new maximum alignment. (APPLE ONLY)
#pragma pack()
acts like a #pragma pack(pop)
directive.
(APPLE ONLY)
#pragma pack(push[,
n])
pushes the current maximum alignment
setting onto an internal stack and then optionally sets the new maximum
alignment.
#pragma pack(pop)
restores the maximum alignment setting to the
one saved at the top of the internal stack (and removes that stack entry).
Some targets, e.g. i386 and powerpc, support the ms_struct
#pragma
which lays out a structure as the documented
__attribute__ ((ms_struct))
.
#pragma ms_struct on
turns on the layout for structures
declared.
#pragma ms_struct off
turns off the layout for structures
declared.
#pragma ms_struct reset
goes back to the default layout.