/Zp (Struct Member Alignment)
Controls how the members of a structure are packed into memory and specifies the same packing for all structures in a module.
The /Zpn option tells the compiler where to store each structure member. The compiler stores members after the first one on a boundary that's the smaller of either the size of the member type, or an n-byte boundary.
The available packing values are described in the following table:
|1||Packs structures on 1-byte boundaries. Same as /Zp.|
|2||Packs structures on 2-byte boundaries.|
|4||Packs structures on 4-byte boundaries.|
|8||Packs structures on 8-byte boundaries (default for x86, ARM, and ARM64).|
|16||Packs structures on 16-byte boundaries (default for x64).|
Don't use this option unless you have specific alignment requirements.
C++ headers in the Windows SDK set and assume /Zp8 packing internally. Memory corruption may occur if the /Zp setting is changed inside the Windows SDK headers. The headers aren't affected by any /Zp option you set on the command line.
You can also use pack to control structure packing. For more information about alignment, see:
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
Select the Configuration Properties > C/C++ > Code Generation property page.
Modify the Struct Member Alignment property.
To set this compiler option programmatically