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

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

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

C++ Language#pragma instantiate A#pragma do_not_instantiate A::fThe template definition of a template entity must be present in the compilation <strong>for</strong> an instantiation to occur.If an instantiation is explicitly requested by use of the instantiate pragma and no template definition isavailable or a specific definition is provided, an error is issued.template void f1(T); // No body providedtemplate void g1(T); // No body providedvoid f1(int) {} // Specific definitionvoid main(){int i;double d;f1(i);f1(d);g1(i);g1(d);}#pragma instantiate void f1(int) // error - specific// definition#pragma instantiate void g1(int) // error - no body// providedf1(double) and g1(double) will not be instantiated (because no bodies were supplied) but no errorswill be produced during the compilation (if no bodies are supplied at link time, a linker error will beproduced).A member function name (e.g., A::f) can only be used as a pragma argument if it refers to asingle user defined member function (i.e., not an overloaded function). Compiler-generated functions arenot considered, so a name may refer to a user defined constructor even if a compiler-generated copyconstructor of the same name exists. Overloaded member functions can be instantiated by providing thecomplete member function declaration, as in#pragma instantiate char* A::f(int, char*)The argument to an instantiation pragma may not be a compiler-generated function, an inline function,or a pure virtual function.2.5.4. Implicit InclusionWhen implicit inclusion is enabled, the C++ compiler is given permission to assume that if it needs adefinition to instantiate a template entity declared in a .h file it can implicitly include the corresponding.cc file to get the source code <strong>for</strong> the definition. For example, if a template entity ABC::f is declared infile xyz.h, and an instantiation of ABC::f is required in a compilation but no definition of ABC::f appearsin the source code processed by the compilation, the compiler will look to see if a file xyz.cc exists, andif so it will process it as if it were included at the end of the main source file.67

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

Saved successfully!

Ooh no, something went wrong!