HP aC++/HP C A.06.20 Programmer's Guide
Why Use Compile-Time Instantiation
Compile-time instantiation is the default. It is easy to use. Your code may compile faster
when using compile-time instantiation.
If your development environment uses a version control system that is sensitive to file
modifications, you may want to use the current default, compile-time instantiation, to
avoid major code rebuilds.
NOTE: If you have used automatic instantiation with earlier versions of HP aC++
there may be some migration issues. See “Migrating from Automatic Instantiation to
Compile-time Instantiation” (page 173) for more information.
Scope
If your source code contains templates and you do not specify any template
command-line options nor explicit instantiations, compile-time instantiation takes place
for any use of a template. If you specify a template command-line option, the option
takes precedence for all translation units on the command line. Any explicit instantiation
takes precedence over either a command-line option or compile-time instantiation.
Usage
Compared with developer-directed instantiation, compile-time instantiation involves
less coding time for the developer. However, the design of your application may require
the use of some form of directed instantiation.
Migrating from Automatic Instantiation to Compile-time Instantiation
If you have used automatic instantiation with earlier versions of HP aC++ there will
be some known migration problems. The following migration problems may occur:
• Creating object files
• Creating an executable
• Closing a set of object files prior to creating a library (.a or .so)
• Creating a shared library (.so)
The following sections describe specific migration scenarios and illustrate possible
migration problems and solutions:
Possible Duplicate Symbols in Shared Libraries
An existing compiler defect may be more apparent, if in HP aC++ A.02.00 or A.01.04
and prior versions you built a shared library using automatic instantiation (the prior
default using the assigner) and now build that library using the current default
(compile-time) instantiation. The defect relates to template objects with constructors
or other runtime initializers that have been globally defined in more than one shared
Invoking Compile-Time Instantiation 173