TEMPINC | NOTEMPINC (C++ only)

Category

C++ template

Pragma equivalent

None.

Purpose

Generates separate template instantiation files for template functions and class declarations, and places these files in a directory or PDS, which can be optionally specified.
Note: The recommended method for handling template instantiations is to use the TEMPLATEREGISTRY compiler option instead of the TEMPINC compiler option. For more information on the TEMPLATEREGISTRY compiler option, see TEMPLATEREGISTRY | NOTEMPLATEREGISTRY (C++ only).

Syntax

Read syntax diagramSkip visual syntax diagram
   .-TEMPINC---.                       
>>-+-NOTEMPINC-+--+----------------+---------------------------><
                  '-(--location--)-'   

Defaults

For a PDS directory, the default option is TEMPINC(TEMPINC). For a z/OS® UNIX System Services file system directory, the default option is TEMPINC(./tempinc).

Note: The c++ compiler invocation command for a regular compile in the z/OS UNIX environment uses TEMPINC(tempinc) as the default option.

In the z/OS UNIX environment, the template instantiation files are by default produced in a ./tempinc directory when C++ source files are compiled with the TEMPINC option.

When the bind step is invoked, using the c++ or cxx commands, and in the presence of ./tempinc directory, the XL C++ compiler is automatically invoked to compile all template instantiation files in the ./tempinc directory. If the command line only includes binder options, the template instantiation files are compiled using the XL C++ compiler defaults. If this is not appropriate for compiling the template instantiation files, all required XL C++ compiler options must be specified on the command line even though the command line is intended to invoke the bind step.

Automatic invocation of the XL C++ compiler is performed by the c89 utility when using the c++ and cxx commands. The same is true when using C++ invocation commands from the xlc utility, except the xlc utility invokes the bind step using the c89 utility. When the xlc utility invokes the c89 utility for the bind step it only passes the binder options, so the template instantiation files are always compiled with the XL C++ compiler defaults. For this reason, the TEMPINC method for processing template instantiations is not recommended with the xlc utility. The TEMPLATEREGISTRY method should be used instead.

Parameters

location
A PDS or a z/OS UNIX file system directory that will contain all template instantiation files. When a PDS is used to contain all template instantiation files, all compilations of a given application must be sequential otherwise two different compilations might need access to the same PDS member at the same time. This can cause a collision leading to incorrect compilation results. For parallel builds, use a z/OS UNIX file system directory for the template instantiation files.

Usage

If you do not specify a location, the compiler places all template instantiation files in a default location. If the source resides in a data set, the default location is a PDS with a low-level qualifier of TEMPINC. The high-level qualifier is the userid under which the compiler is running. If the source resides in a z/OS UNIX file, the default location is the z/OS UNIX file system directory ./tempinc.

The NOTEMPINC option can optionally take a filename suboption. This filename then becomes the default. If you subsequently use the TEMPINC option without a filename suboption, then the compiler uses the filename that you specified in the earlier NOTEMPINC. For example, the following specifications have the same result:
c++ -Wc,"NOTEMPINC(hello)" -Wc,TEMPINC ./hello.C 
c++ -Wc,"TEMPINC(hello)" ./hello.C 
If you specify TEMPINC and NOTEMPINC multiple times, the compiler uses the last specified option with the last specified suboption. For example, the following specifications have the same result:
c++ -Wc,"NOTEMPINC(hello)" -Wc,"TEMPINC(n1)" -Wc,"NOTEMPINC(test)" -Wc,TEMPINC
./hello.C 
c++ -Wc,"TEMPINC(test)" ./hello.C

If you have large numbers of recursive templates, consider using FASTT. See FASTTEMPINC | NOFASTTEMPINC (C++ only) for details.

Note: If you use the following form of the command in the batch environment where xxx is an unallocated data set, you may get undefined results.
TEMPINC(xxx)

IPA effects

The IPA link step issues a diagnostic message if you specify the TEMPINC option for that step.

Predefined macros

__TEMPINC__ is predefined to 1 when the TEMPINC compiler option is in effect; otherwise it is undefined.