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.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>--instantiate=localSimilar to --instantiate=used except that the functions are given internal linkage. This is intended toprovide a very simple mechanism <strong>for</strong> those getting started with templates. The compiler will instantiatethe functions that are used in each compilation unit as local functions, and the program will link and runcorrectly (barring problems due to multiple copies of local static variables.) However, one may end upwith many copies of the instantiated functions, so this is not suitable <strong>for</strong> production use. --instantiate=localcannot be used in conjunction with automatic template instantiation. If automatic instantiation is enabledby default, it will be disabled by the --instantiate=local option.In the case where the ccarm command is given a single file to compile and link, e.g.,ccarm test.ccthe compiler knows that all instantiations will have to be done in the single source file. There<strong>for</strong>e, it usesthe --instantiate=used mode and suppresses automatic instantiation.2.5.3. Instantiation #pragma DirectivesInstantiation pragmas can be used to control the instantiation of specific template entities or sets oftemplate entities. There are three instantiation pragmas:• The instantiate pragma causes a specified entity to be instantiated.• The do_not_instantiate pragma suppresses the instantiation of a specified entity. It is typically usedto suppress the instantiation of an entity <strong>for</strong> which a specific definition will be supplied.• The can_instantiate pragma indicates that a specified entity can be instantiated in the currentcompilation, but need not be; it is used in conjunction with automatic instantiation, to indicate potentialsites <strong>for</strong> instantiation if the template entity turns out to be required.The argument to the instantiation pragma may be:• a template class name A• a template class declaration class A• a member function name A::f• a static data member name A::i• a static data declaration int A::i• a member function declaration void A::f(int,char)• a template function declaration char* f(int, float)A pragma in which the argument is a template class name (e.g., A or class A) is equivalentto repeating the pragma <strong>for</strong> each member function and static data member declared in the class. Wheninstantiating an entire class a given member function or static data member may be excluded using thedo_not_instantiate pragma. For example,66

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

Saved successfully!

Ooh no, something went wrong!