Alignment Rules for Nested Aggregates

Aggregates with different alignments can be nested. Each aggregate is laid out using the alignment rules applicable to it. The start position of the nested aggregate is determined by the alignment rules of the aggregate in which it is nested.

Example
The following example uses these symbols to show padding and boundaries:

     p = padding
     | = halfword boundary
     : = byte boundary

For:

     #pragma options align=mac68k
     struct A {
       char a;
     #pragma options align=power
       struct B {
         int b;
         char c;
       } B1;    // <-- B1 laid out using RISC System/6000 alignment rules
     #pragma options align=reset    // <-- has no effect on A or B, but
                                    //     on subsequent structs
       char d;
     };
 
     sizeof(A) == 12

The layout of A is:

     |a:p|b:b|b:b|c:p|p:p|d:p|


align Compiler Option
RISC System/6000 Alignment Rules
Macintosh and Twobyte Alignment Rules
Packed Alignment Rules