pack

Controls the alignment of data structures.

Syntax

#pragma pack( [n | push, n | pop] )

Targets
Intel x86, MIPS
Remarks

Sets the packing alignment for data structures. It affects all data structures declared after this pragma until you change it again with another pack pragma.

This pragma… Does this…
#pragma pack(n) Sets the alignment modulus to n, where n can be 1, 2, 4, 8, or 16. For MIPS compilers, if n is 0, structure alignment is reset to the default setting.
#pragma pack(push, n) Pushes the current alignment modulus on a stack, then sets it to n, where n can be 1, 2, 4, 8, or 16. Use push and pop when you need a specific modulus for some declaration or set of declarations, but do not want to disturb the default setting. MIPS compilers do not support this form.
#pragma pack(pop) Pops a previously pushed alignment modulus from the stack. MIPS compilers do not support this form.
#pragma pack() For x86 compilers, resets alignment modulus to the value specified in the x86 CodeGen panel. For MIPS compilers, resets structure alignment to the default setting.

This pragma corresponds to the Byte Alignment setting in the x86 CodeGen panel.