|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
5.47.6 Structure-Packing Pragmas
For compatibility with Win32, GCC supports a set of
directives which change the maximum alignment of members of structures,
unions, and classes subsequently defined. The n value below always
is required to be a small power of two and specifies the new alignment
#pragma pack(n)simply sets the new alignment.
#pragma pack()sets the alignment to the one that was in effect when compilation started (see also command line option ‘-fpack-struct[=<n>]’ see section Options for Code Generation Conventions).
#pragma pack(push[,n])pushes the current alignment setting on an internal stack and then optionally sets the new alignment.
#pragma pack(pop)restores the alignment setting to the one saved at the top of the internal stack (and removes that stack entry). Note that
#pragma pack([n])does not influence this internal stack; thus it is possible to have
#pragma pack(push)followed by multiple
#pragma pack(n)instances and finalized by a single