29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>Compiler</strong>-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 />

Example<br />

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

See also<br />

• --min_array_alignment=opt on page 2-62 in the <strong>Compiler</strong> <strong>Reference</strong> <strong>Guide</strong>.<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 />

Syntax<br />

__alignof__(type)<br />

__alignof__(expr)<br />

Where:<br />

type<br />

expr<br />

is a type<br />

is an lvalue.<br />

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

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!