The __align type qualifier

IBM Extension Beginning of IBM® Extension.

The __align qualifier is a language extension that allows you to specify an explicit alignment for an aggregate or a static (or global) variable. The specified byte boundary affects the alignment of an aggregate as a whole, not that of its members. The __align qualifier can be applied to an aggregate definition nested within another aggregate definition, but not to individual elements of an aggregate. The alignment specification is ignored for parameters and automatic variables.

A declaration takes one of the following forms:

__align qualifier syntax for simple variables

Read syntax diagramSkip visual syntax diagramtype specifier __align(int_constant) declarator

__align qualifier syntax for structures or unions

Read syntax diagramSkip visual syntax diagram__align(int_constant ) structunion tag_identifier{member_declaration_list };
where int_constant is a positive integer value indicating the byte-alignment boundary. The legal values are 1, 2, 4, 8, or any other positive power of two.
The following restrictions and limitations apply:
  • The __align qualifier cannot be used where the size of the variable alignment is smaller than the size of the type alignment.
  • Not all alignments may be representable in an object file.
  • The __align qualifier cannot be applied to the following:
    • Individual elements within an aggregate definition.
    • Individual elements of an array.
    • Variables of incomplete type.
    • Aggregates declared but not defined.
    • Other types of declarations or definitions, such as a typedef, a function, or an enumeration.

IBM Extension End of IBM Extension.