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.

C and C++ Implementation Details<br />

Note<br />

In C, this code is legal but has a different meaning. A tentative declaration of f is<br />

followed by its definition.<br />

5.2.5 Template instantiation<br />

The <strong>ARM</strong> compiler does all template instantiations automatically, and makes sure there<br />

is only one definition of each template entity left after linking. The compiler does this<br />

by emitting template entities in named common sections. Therefore, all duplicate<br />

common sections, that is, common sections with the same name, are eliminated by the<br />

linker.<br />

Note<br />

You can limit the number of concurrent instantiations of a given template with the<br />

--pending_instantiations compiler option.<br />

See also --pending_instantiations=n on page 2-103 for more information.<br />

Implicit inclusion<br />

When implicit inclusion is enabled, the compiler assumes that if it requires a definition<br />

to instantiate a template entity declared in a .h file it can implicitly include the<br />

corresponding .cc file to get the source code for the definition. For example, if a<br />

template entity ABC::f is declared in file xyz.h, and an instantiation of ABC::f is required<br />

in a compilation but no definition of ABC::f appears in the source code processed by the<br />

compilation, then the compiler checks to see if a file xyz.cc exists. If this file exists, the<br />

compiler processes the file as if it were included at the end of the main source file.<br />

To find the template definition file for a given template entity the compiler has to know<br />

the full path name of the file where the template is declared and whether the file is<br />

included using the system include syntax, for example, #include . This<br />

information is not available for preprocessed source containing #line directives.<br />

Consequently, the compiler does not attempt implicit inclusion for source code<br />

containing #line directives.<br />

The compiler looks for the definition-file suffixes .cc and .CC.<br />

You can turn implicit inclusion mode on or off with the command-line options<br />

--implicit_include and --no_implicit_include.<br />

Implicit inclusions are only performed during the normal compilation of a file, that is,<br />

when not using the -E command-line option.<br />

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

ID101213<br />

Non-Confidential,

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

Saved successfully!

Ooh no, something went wrong!