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

Example 4-2 Global register - declaration error<br />

int x;<br />

__global_reg(1) int x; // error<br />

In C, __global_reg variables cannot be initialized at definition. Example 4-3 produces<br />

an error in C, but not in C++.<br />

Example 4-3 Global register - initialization error<br />

__global_reg(1) int x=1; // error in C, OK in C++<br />

See also<br />

• --global_reg=reg_name[,reg_name,...] on page 2-67.<br />

4.1.7 __inline<br />

The __inline keyword suggests to the compiler that it compiles a C or C++ function<br />

inline, if it is sensible to do so.<br />

The semantics of __inline are exactly the same as those of the inline keyword.<br />

However, inline is not available in C90.<br />

__inline is a storage class qualifier. It does not affect the type of a function.<br />

Example<br />

__inline int f(int x)<br />

{<br />

return x*5+1;<br />

}<br />

int g(int x, int y)<br />

{<br />

return f(x) + f(y);<br />

}<br />

See also<br />

• Function inlining on page 5-18 in the Compiler User Guide.<br />

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

ID101213<br />

Non-Confidential,

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

Saved successfully!

Ooh no, something went wrong!