You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,16 +25,16 @@ Specifies the packing alignment for structure, union, and class members.
25
25
(Optional) Pushes the current packing alignment value on the internal compiler stack, and sets the current packing alignment value to *n*. If *n* isn't specified, the current packing alignment value is pushed.
26
26
27
27
**pop**\
28
-
(Optional) Removes the record from the top of the internal compiler stack. If *n* isn't specified with **pop**, then the packing value associated with the resulting record on the top of the stack is the new packing alignment value. If *n* is specified, for example, `#pragma pack(pop, 16)`, *n* becomes the new packing alignment value. If you pop using an *identifier*, for example, `#pragma pack(pop, r1)`, then all records on the stack are popped until the record that has *identifier* is found. That record is popped, and the packing value associated with the resulting record on the top of the stack is the new packing alignment value. If you pop using an *identifier* that isn't found in any record on the stack, then the **pop** is ignored.
28
+
(Optional) Removes the record from the top of the internal compiler stack. If *n* isn't specified with **pop**, then the packing value associated with the resulting record on the top of the stack is the new packing alignment value. If *n* is specified, for example, `#pragma pack(pop, 16)`, *n* becomes the new packing alignment value. If you pop using an *identifier*, for example, `#pragma pack(pop, r1)`, then all records on the stack are popped until the record that has *identifier* is found. That record is popped, and the packing value associated with the resulting record on the top of the stack is the new packing alignment value. If you pop using an *identifier* that isn't found in any record on the stack, then the **pop** is ignored.
29
+
30
+
The statement `#pragma pack (pop, r1, 2)` is equivalent to `#pragma pack (pop, r1)` followed by `#pragma pack(2)`.
29
31
30
32
*identifier*\
31
33
(Optional) When used with **push**, assigns a name to the record on the internal compiler stack. When used with **pop**, pops records off the internal stack until *identifier* is removed. If *identifier* isn't found on the internal stack, nothing is popped.
32
34
33
35
*n*\
34
36
(Optional) Specifies the value, in bytes, to be used for packing. If the compiler option [/Zp](../build/reference/zp-struct-member-alignment.md) isn't set for the module, the default value for *n* is 8. Valid values are 1, 2, 4, 8, and 16. The alignment of a member is on a boundary that's either a multiple of *n*, or a multiple of the size of the member, whichever is smaller.
35
37
36
-
`#pragma pack(pop, identifier, n)` is undefined.
37
-
38
38
## Remarks
39
39
40
40
To *pack* a class is to place its members directly after each other in memory. It can mean that some or all members can be aligned on a boundary smaller than the default alignment of the target architecture. **pack** gives control at the data-declaration level. It differs from compiler option [/Zp](../build/reference/zp-struct-member-alignment.md), which only provides module-level control. **pack** takes effect at the first **struct**, **union**, or **class** declaration after the pragma is seen. **pack** has no effect on definitions. Calling **pack** with no arguments sets *n* to the value set in the compiler option `/Zp`. If the compiler option isn't set, the default value is 8.
@@ -103,6 +103,9 @@ The following sample shows how to use the *push*, *pop*, and *show* syntax.
103
103
#pragma pack(show) // C4810
104
104
#pragma pack(push, r1, 16) // n = 16, pushed to stack
0 commit comments