|
VMS Help CXX, Qualifiers, /TEMPLATE_DEFINE *Conan The Librarian |
/TEMPLATE_DEFINE=(option,...)
/NOTEMPLATE_DEFINE
Controls compiler behavior pertaining to the instantiation of C++
templates. See "Using Templates" in the HP C++ User's Guide for
OpenVMS Systems for details on how to instantiate templates using
this qualifier.
Note that you must specify a value for /TEMPLATE_DEFINE.
Select only one of the following optional values to determine the
template instantiation model:
Option Usage
ALL Instantiate all template entities declared
or referenced in the compilation unit,
including typedefs. For each fully
instantiated template class, all its
member functions and static data members
are instantiated even if they were not
used. Nonmember template functions are
instantiated even if the only reference
was a declaration. Instantiations are
created with external linkage. Overrides
/REPOSITORY at compile time. Instantiations
are placed in the user's object file
ALL_REPOSITORY Instantiate all templates declared or
used in the source program and put the
object code generated as separate object
files in the repository. Instantiations
caused by manual instantiation directives
are also put in the repository. This is
similar to /TEMPLATE_DEFINE=ALL except that
explicit instantiations are also put in the
repository, rather than than an external
symbol being put in the main object file.
This qualifier is useful for creating a
pre-instantiation library.
AUTOMATIC Directs the compiler to use the automatic
instantiation model of C++ templates.
/TEMPLATE_DEFINE=AUTOMATIC is the default.
NOAUTOMATIC Directs the compiler to not implicitly
instantiate templates.
IMPLICIT_LOCAL Same as /TEMPLATE_DEFINE=LOCAL, except
manually instantiated templates are placed
in the repository with external linkage.
This is useful for build systems that need
to have explicit control of the template
instantiation mechanism. This mode can
suffer the same limitations as /TEMPLATE_
DEFINE=LOCAL. This mode is the default when
/STANDARD=GNU is specified.
LOCAL Similar to /TEMPLATE_DEFINE=USED except
that the functions are given internal
linkage. This qualifier provides a
simple mechanism for getting started with
templates. The compiler instantiates as
local functions the functions used in
each compilation unit, and the program
links and runs correctly (barring problems
resulting from multiple copies of local
static variables). However, because many
copies of the instantiated functions can be
generated, this qualifier might not be not
suitable for production use.
The /TEMPLATE_DEFINE=LOCAL qualifier cannot
be used in conjunction with automatic
template instantiation. If automatic
instantiation is enabled by default, it
is disabled by the /TEMPLATE_DEFINE=LOCAL
qualifier. Explicit use of /TEMPLATE_
DEFINE=LOCAL and /TEMPLATE_DEFINE=AUTO
is an error.
USED Instantiate those template entities that
were used in the compilation. This includes
all static data members for which there are
template definitions. Overrides /TEMPLATE_
DEFINE=AUTO at compile time.
USED_REPOSITORY Like ALL_REPOSITORY, but instantiates only
templates used by the compilation. The
explicit instantiations are also put into
the repository as separate object files.
The following /TEMPLATE_DEFINE optional values are independent of
the model used and each other:
Option Usage
DEFINITION_FILE_ Specifies a string that contains a
TYPE="file-type- list of file types that are valid for
list" template definition files. Items in
the list must be separated by commas
and preceded by a period. A type is not
allowed to exceed the OpenVMS limit of 31
characters. This qualifier is applicable
only when automatic instantiation has
been specified. The default is /TEMPLATE_
DEFINE=DEF=".CXX,.C,.CC,.CPP".
PRAGMA Determines whether the compiler ignores
#pragma define_template directives
encountered during the compilation. This
qualifier lets you quickly switch to
automatic instantiation without having
to remove all the pragma directives from
your program's code base. The default is
/TEMPLATE_DEFINE=PRAGMA, which enables
#pragma define_template.
VERBOSE Turns on verbose or verify mode to display
each phase of instantiation as it occurs.
During the compilation phase, informational
level diagnostics are generated to indicate
which templates are automatically being
instantiated. This qualifier is useful as a
debugging aid.
TIMESTAMP (Alpha only applicable if a repository is being
only) used. Causes the compiler to create a
timestamp file named TIMESTAMP. in the
repository. Thereafter, instantiations are
added or regenerated only if needed; that
is, if they do not alreay exist, or if
existing ones are older than the timestamp.
Also see /REPOSITORY.
Also see /PENDING_INSTANTIATIONS.
|
|