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

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

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

Compiler-specific Features<br />

Return value<br />

__ALIGNOF__(type) returns the alignment requirement for the type type, or 1 if there is<br />

no alignment requirement.<br />

__ALIGNOF__(expr) returns the alignment requirement for the type of the lvalue expr, or<br />

1 if there is no alignment requirement. The lvalue itself is not evaluated.<br />

Example<br />

typedef struct s_foo { int i; short j; } foo;<br />

typedef __packed struct s_bar { int i; short j; } bar;<br />

return __ALIGNOF(struct s_foo); // returns 4<br />

return __ALIGNOF(foo); // returns 4<br />

return __ALIGNOF(bar); // returns 1<br />

See also<br />

• __alignof__ on page 4-3.<br />

4.1.4 __asm<br />

This keyword is used to pass information from the compiler to the <strong>ARM</strong> assembler<br />

armasm.<br />

The precise action of this keyword depends on its usage.<br />

Usage<br />

Embedded assembler<br />

The __asm keyword can be used to declare or define an embedded<br />

assembly function. For example:<br />

__asm void my_strcpy(const char *src, char *dst);<br />

See Embedded assembler on page 7-17 in the Compiler User Guide for<br />

more information.<br />

Inline assembler<br />

The __asm keyword can be used to incorporate inline assembly into a<br />

function. For example:<br />

int qadd(int i, int j)<br />

{<br />

int res;<br />

__asm<br />

{<br />

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

ID101213<br />

Non-Confidential,

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

Saved successfully!

Ooh no, something went wrong!