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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong>-specific Features<br />

short x;<br />

char y;<br />

__packed int z;<br />

// only pack this field<br />

char a;<br />

} Y; // 8 byte structure, natural alignment = 2<br />

int g(Y *p)<br />

{<br />

return p->z + p->x;<br />

}<br />

// only unaligned read for z<br />

See also<br />

• __attribute__((packed)) on page 4-44<br />

• Packed structures on page 5-10<br />

• The __packed qualifier and unaligned accesses to data on page 4-24 in the<br />

<strong>Compiler</strong> User <strong>Guide</strong><br />

• __packed structures versus individually __packed fields on page 4-26 in the<br />

<strong>Compiler</strong> User <strong>Guide</strong>.<br />

4.1.12 __pure<br />

The __pure keyword asserts that a function declaration is pure.<br />

A function is pure only if:<br />

• the result depends exclusively on the values of its arguments<br />

• the function has no side effects.<br />

__pure is a function qualifier. It affects the type of a function.<br />

Note<br />

This keyword has the function attribute equivalent __attribute__((const)).<br />

Default<br />

By default, functions are assumed to be impure.<br />

Usage<br />

Pure functions are candidates for common subexpression elimination.<br />

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

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!