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

Exit Print View

Updated: March 2015
 
 

7.3.3 Global Instances

Unlike with early compiler releases, you do not have to guard against multiple copies of a global instance.

The advantage of this method is that incorrect source code commonly accepted by other compilers is now also accepted in this mode. In particular, references to static variables from within a template instances are not legal but are commonly accepted.

The disadvantage of this method is that individual object files may be larger due to copies of template instances in multiple files. If you compile some object files for debug using the -g option and some without, it is hard to predict whether you will get a debug or non-debug version of a template instance linked into the program.

Template instances receive global linkage. These instances are visible and usable outside the current compilation unit.

Specify global instances with the -instances=global option (the default).