04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Compiler-specific Features<br />

Usage<br />

__align(n) is useful when the normal alignment of the variable being declared is less<br />

than n. Eight-byte alignment can give a significant performance advantage with VFP<br />

instructions.<br />

__align can be used in conjunction with extern and static.<br />

Restrictions<br />

Because __align is a storage class modifier, it cannot be used on:<br />

• types, including typedefs and structure definitions<br />

• function parameters.<br />

You can only overalign. That is, you can make a two-byte object four-byte aligned but<br />

you cannot align a four-byte object at 2 bytes.<br />

Examples<br />

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

void foo(void)<br />

{<br />

...<br />

__align(16) int i; // this alignment value is not permitted for<br />

// a local variable<br />

...<br />

}<br />

__align(16) int i; // permitted as a global variable.<br />

See also<br />

• --min_array_alignment=opt on page 2-91 in the Compiler User Guide.<br />

4.1.2 __alignof__<br />

The __alignof__ keyword enables you to enquire about the alignment of a type or<br />

variable.<br />

Note<br />

This keyword is a GNU compiler extension that is supported by the <strong>ARM</strong> compiler.<br />

<strong>ARM</strong> DUI 0348C Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. 4-3<br />

ID101213<br />

Non-Confidential,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!