The data format described here for aligned structures is based on the alignment produced by compiling with the /Sp compiler option.
The C++ compiler may generate extra fields for
classes that contain base classes or virtual functions. Objects
of these types may not conform to the mapping shown below.
| Type | struct | ||||||||||||||||||||||||||||||||
| Size | Sum of the sizes for each type in the struct plus padding for alignment | ||||||||||||||||||||||||||||||||
| Alignment | IBM C and C++ Compilers
determines which element has the most restrictive
alignment rule, then aligns the first element according
to that rule. The alignment of the individual members is
not changed. In the following example, types char, short, and float are used in the struct. Because float must be aligned on the 4-byte boundary, and because this is the most restrictive alignment rule, the first element must be aligned on the 4-byte boundary even though it is only a char.
|
||||||||||||||||||||||||||||||||
| Storage Mapping |
High memory is to the
right.
|