gcc: Alignment

1 
1 6.42 Inquiring on Alignment of Types or Variables
1 =================================================
1 
1 The keyword '__alignof__' allows you to inquire about how an object is
1 aligned, or the minimum alignment usually required by a type.  Its
1 syntax is just like 'sizeof'.
1 
1  For example, if the target machine requires a 'double' value to be
1 aligned on an 8-byte boundary, then '__alignof__ (double)' is 8.  This
1 is true on many RISC machines.  On more traditional machine designs,
1 '__alignof__ (double)' is 4 or even 2.
1 
1  Some machines never actually require alignment; they allow reference to
1 any data type even at an odd address.  For these machines, '__alignof__'
1 reports the smallest alignment that GCC gives the data type, usually as
1 mandated by the target ABI.
1 
1  If the operand of '__alignof__' is an lvalue rather than a type, its
1 value is the required alignment for its type, taking into account any
11 minimum alignment specified with GCC's '__attribute__' extension (⇒
 Variable Attributes).  For example, after this declaration:
1 
1      struct foo { int x; char y; } foo1;
1 
1 the value of '__alignof__ (foo1.y)' is 1, even though its actual
1 alignment is probably 2 or 4, the same as '__alignof__ (int)'.
1 
1  It is an error to ask for the alignment of an incomplete type.
1