HP C Programmer's Guide (92434-90009)

40 Chapter2
Storage and Alignment Comparisons
Aligning Structures Between Architectures
Figure 2-12. Storage on VAX/VMS C
Table on page 41 shows the padding for the example code fragment:
Table 2-7. Padding on VAX/VMS C
Padding
Location
Reason for Padding
a+1 The most restrictive type of any struct x member is short; therefore, struct x
is 2-byte aligned.
a+5 Aligns the short z on a 2-byte boundary.
a+13 Fills out the struct x to a 2-byte boundary.
a+17 Needed for alignment of the short z.
a+25
through
a+27
Fills out the structure to a 2-byte boundary and aligns the double u on a 4-byte
boundary.
a+37 Aligns the char m on a byte boundary.
a+39 Fills out the structure to a 4-byte boundary.