13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>To find the template definition file <strong>for</strong> a given template entity the C++ compiler needs to know the pathname specified in the original include of the file in which the template was declared and whether the filewas included using the system include syntax (e.g., #include ). This in<strong>for</strong>mation is notavailable <strong>for</strong> preprocessed source containing #line directives. Consequently, the C++ compiler will notattempt implicit inclusion <strong>for</strong> source code containing #line directives.The file to be implicitly included is found by replacing the file suffix with each of the suffixes specified inthe instantiation file suffix list. The normal include search path mechanism is then used to look <strong>for</strong> the fileto be implicitly included.By default, the list of definition-file suffixes tried is .c, .cc, .cpp, and .cxx.Implicit inclusion works well alongside automatic instantiation, but the two are independent. They can beenabled or disabled independently, and implicit inclusion is still useful when automatic instantiation is notdone.The implicit inclusion mode can be turned on by the command line option --implicit-include. If this optionis turned on, you cannot use exported templates.Implicit inclusions are only per<strong>for</strong>med during the normal compilation of a file, (i.e., not when doing onlypreprocessing). A common means of investigating certain kinds of problems is to produce a preprocessedsource file that can be inspected. When using implicit inclusion it is sometimes desirable <strong>for</strong> thepreprocessed source file to include any implicitly included files. This may be done using the commandline option --no-preprocessing-only. This causes the preprocessed output to be generated as part of anormal compilation. When implicit inclusion is being used, the implicitly included files will appear as partof the preprocessed output in the precise location at which they were included in the compilation.2.5.5. Exported TemplatesExported templates are templates declared with the keyword export. Exporting a class template isequivalent to exporting each of its static data members and each of its non-inline member functions. Anexported template is special because its definition does not need to be present in a translation unit thatuses that template. In other words, the definition of an exported (non-class) template does not need tobe explicitly or implicitly included in a translation unit that instantiates that template. For example, thefollowing is a valid C++ program consisting of two separate translation units:// File 1:#include static void trace() { printf("File 1\n"); }export template T const& min(T const&, T const&);int main(){trace();return min(2, 3);}// File 2:#include static void trace() { printf("File 2\n"); }68

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

Saved successfully!

Ooh no, something went wrong!