Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
| Overview | How Do I | Compiler Options
The Struct Member Alignment (/Zpn) option controls how the members of a structure are packed into memory and specifies the same packing for all structures in a module. When you specify this option, each structure member after the first is stored on either the size of the member type or n-byte boundaries (where n is 1, 2, 4, 8, or 16), whichever is smaller.
You should not use this option unless you have specific alignment requirements.
| Command Line | Project Settings | Result |
| /Zp1 | 1 Byte | Packs structures on 1-byte boundaries |
| /Zp2 | 2 Bytes | Packs structures on 2-byte boundaries |
| /Zp4 | 4 Bytes | Packs structures on 4-byte boundaries |
| /Zp8 | 8 Bytes | Packs structures on 8-byte boundaries (default) |
| /Zp16 | 16 Bytes | Packs structures on 16-byte boundaries |
| /Zp | Not applicable | Specifies the same packing for all structures in a module. |
To find this option in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click Code Generation in the Category box.
You can also use #pragma pack to control structure packing.