-qtemplateregistry

C++ only

Description

Maintains records of all templates as they are encountered in the source and ensures that only one instantiation of each template is made.

Syntax

Read syntax diagramSkip visual syntax diagram        .-notemplateregistry---------------------.
>>- -q--+-templateregistry--+------------------+-+-------------><
                            '-=--registry_file-'

Notes

The first time that the compiler encounters a reference to a template instantiation, that instantiation is generated and the related object code is placed in the current object file. Any further references to identical instantiations of the same template in different compilation units are recorded but the redundant instantiations are not generated. No special file organization is required to use the -qtemplateregistry option.

If you do not specify a location, the compiler will save all template registry information to the file templateregistry stored in the current working directory. Template registry files must not be shared between different programs. If there are two or more programs whose source is in the same directory, relying on the default template registry file stored in the current working directory will result in this situation, and may lead to incorrect results.

The -qtempinc and -qtemplateregistry compiler options are mutually exclusive. Specifying -qtempinc implies -qnotemplateregistry. Similarly, specifying -qtemplateregistry implies -qnotempinc. However, specifying -qnotempinc does not imply -qtemplateregistry.

Specifying either -qtempinc or -qtemplateregistry implies -qtmplinst=auto.

Example

To compile the file myprogram.C and place the template registry information into the /tmp/mytemplateregistry file, enter:

 xlc++ myprogram.C -qtemplateregistry=/tmp/mytemplateregistry

Related information