| aligned

| Specifying Attributes of Variables | Next

Syntax: aligned [(alignment)]
This attribute specifies a minimum alignment for the variable or structure field, measured in bytes. For example, the declaration:

    int x __attribute__ ((aligned (4))) = 0;

causes the compiler to allocate the global variable `x` on a 4-byte boundary.
You can also specify the alignment of structure fields. For example, to create a 4-byte aligned `int` pair, you could write:

    struct foo { int x[2] __attribute__ ((aligned (4))); };

As in the preceding examples, you can explicitly specify the alignment (in bytes) that you wish the compiler to use for a given variable or structure field. Alternatively, you can leave out the alignment factor and just ask the compiler to align a variable or field to the maximum useful alignment for the target machine you are compiling for. For example, you could write:

    short array[3] __attribute__ ((aligned));

Whenever you leave out the alignment factor in an `aligned` attribute specification, the compiler automatically sets the alignment for the declared variable or field to the largest alignment which is ever used for any data type on the target machine you are compiling for (useless in TIGCC, since everything is already aligned well enough with the default 2-byte alignment).
The `aligned` attribute can only increase the alignment; but you can decrease it by specifying `packed` as well.