Next: , Up: Representation Clauses and Pragmas


7.1 Alignment Clauses

GNAT requires that all alignment clauses specify a power of 2, and all default alignments are always a power of 2. The default alignment values are as follows:

An alignment clause may specify a larger alignment than the default value up to some maximum value dependent on the target (obtainable by using the attribute reference Standard'Maximum_Alignment). It may also specify a smaller alignment than the default value for enumeration, integer and fixed point types, as well as for record types, for example

       type V is record
          A : Integer;
       end record;
     
       for V'alignment use 1;

The default alignment for the type V is 4, as a result of the Integer field in the record, but it is permissible, as shown, to override the default alignment of the record with a smaller value.