Table 11-1 lists the precompiled header #pragmas directives, along with a short description of each and the compiler versions in which the directive is supported.
Table 11-1. Precompiled Header #pragma Directives
#pragma | Short Description | Compiler Versions |
---|---|---|
#pragma hdrstop | Indicates the point at which the precompiled header mechanism snapshots the headers. If -pch is off, #pragma hdrstop is ignored. | 7.2 and later |
#pragma no_pch | Disables the precompiled header mechanism. | 7.2 and later |
#pragma once | Ensures (in -n32 and -64 mode) that an include file is included at most one time in each compilation unit. | 7.0 and later |
The #pragma hdrstop directive indicates the point at which the precompiled header mechanism snapshots the headers.
The syntax of the #pragma hdrstop directive is as follows:
#pragma hdrstop |
If -pch is on, #pragma hdrstop indicates the point at which the precompiled header mechanism snapshots the headers.
If -pch is off, #pragma hdrstop is ignored.
See the MIPSpro N32/64 Compiling and Performance Tuning Guide for details on the precompiled header mechanism.
The #pragma no_pch directive disables the precompiled header mechanism.
The syntax of #pragma no_pch is as follows:
#pragma no_pch |
The #pragma once directive ensures (in -n32 and -64 mode) that each include file is included one time in each compilation unit.
The syntax of #pragma once is as follows:
#pragma once |
This directive has no effect in -o32 mode, but will ensure idempotent include files in -n32 and -64 mode (that is, that an include file is included at most one time in each compilation unit).
SGI recommends enclosing the contents of an afile.h include file with an #ifdef directive similar to the following:
#ifndef afile_INCLUDED #define afile_INCLUDED <contents of afile.h> #endif |