Oracle® Solaris Studio 12.4: C++ User's Guide

Exit Print View

Updated: March 2015
 
 

7.2.4 Template Instance Placement and Linkage

By default, instances go into special address sections, and the linker recognizes and discards duplicates. You can instruct the compiler to use one of five instance placement and linkage methods: external, static, global, explicit, and semi-explicit.

  • External instances perform best when the following is true:

    • The set of instances in the program is small but each compilation unit references a large subset of the instances.

    • Few instances are referenced in more than one or two compilation units.

    Static instances are deprecated.

  • Global instances, the default, are suitable for all development, and perform best when objects reference a variety of instances.

  • Explicit instances are suitable for some carefully controlled application compilation environments.

  • Semi-explicit instances require slightly less controlled compilation environments but produce larger object files and have restricted uses.

This section discusses the five instance placement and linkage methods. Additional information about generating instances can be found in Template Instantiation.