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.

C and C++ Implementation Details<br />

5.2.8 Extern inline functions<br />

The ISO C++ Standard requires inline functions to be defined wherever you use them.<br />

To prevent the clashing of multiple out-of-line copies of inline functions, the C++<br />

compiler emits out-of-line extern functions in common sections.<br />

Out-of-line inline functions<br />

The compiler emits inline functions out-of-line, in the following cases:<br />

• The address of the function is taken, for example:<br />

inline int g()<br />

{<br />

return 1;<br />

}<br />

int (*fp)() = &g;<br />

• The function cannot be inlined, for example, a recursive function:<br />

inline int g()<br />

{<br />

return g();<br />

}<br />

• The heuristic used by the compiler decides that it is better not to inline the<br />

function. This heuristic is influenced by -Ospace and -Otime. If you use -Otime, the<br />

compiler inlines more functions. You can override this heuristic by declaring a<br />

function with __forceinline. For example:<br />

__forceinline int g()<br />

{<br />

return 1;<br />

}<br />

See also --forceinline on page 2-39 for more information.<br />

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

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!