Next: , Previous: Symbol-Renaming Pragmas, Up: Pragmas


5.50.6 Structure-Packing Pragmas

For compatibility with Win32, GCC supports a set of #pragma 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 maximum alignment in bytes.

  1. #pragma pack(n) pushes the current maximum alignment setting onto an internal stack and then sets the new maximum alignment. (APPLE ONLY)
  2. #pragma pack() acts like a #pragma pack(pop) directive. (APPLE ONLY)
  3. #pragma pack(push[,n]) pushes the current maximum alignment setting onto an internal stack and then optionally sets the new maximum alignment.
  4. #pragma pack(pop) restores the maximum alignment setting to the one saved at the top of the internal stack (and removes that stack entry).