4.1.1. __align

The __align keyword instructs the compiler to align a variable on an n-byte boundary.

__align is a storage class modifier. It does not affect the type of the function.





is the alignment boundary.

n can take the values 1, 2, 4, or 8.

The keyword __align comes immediately before the variable name.


__align(n) is useful when the normal alignment of the variable being declared is less than n. Eight-byte alignment can give a significant performance advantage with VFP instructions.

__align can be used in conjunction with extern and static.


Because __align is a storage class modifier, it cannot be used on:

  • types, including typedefs and structure definitions

  • function parameters.

You can only overalign. That is, you can make a two-byte object four-byte aligned but you cannot align a four-byte object at 2 bytes.


__align(8) char buffer[128];  /* buffer starts on eight-byte boundary */

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A