#pragma directive to control the actions
of the compiler in a particular portion of a program without affecting
the program as a whole.
Put pragmas in your C++ source code where you want them to take effect. A pragma is in effect from the point where it is included to the end of the compilation unit or until another pragma changes its status.
A #pragma directive is an instruction to the compiler and is
ignored during preprocessing.
#pragma pragma-stringpragma-string can be one of the following instructions to the compiler with any required parameters.
#pragma OPTIMIZE ON #pragma OPTIMIZE OFF
Use this pragma to turn off optimization in sections of a source program.
NOTE:
aCC +O2 prog.C
#pragma OPTIMIZE OFF
void A(){ // Turn off optimization
... // for this function
}
#pragma OPTIMIZE ON
void B(){ // Restore optimization
... // to level 2.
}
#pragma OPT_LEVEL 1 #pragma OPT_LEVEL 2 #pragma OPT_LEVEL 3 #pragma OPT_LEVEL 4
OPT_LEVEL pragma sets the optimization level to
1, 2, 3, or 4.
NOTE:
OPT_LEVEL 3 and 4 are allowed only at the
beginning of a file.
aCC -O prog.C
#pragma OPT_LEVEL 1
void A(){ // Optimize this function at level 1.
...
}
#pragma OPT_LEVEL 2
void B(){ // Restore optimization to level 2.
...
}
#pragma HP_SHLIB_VERSION ["]date["]The date argument is of the form month/year, optionally enclosed in quotes.
94
for 1994) or a full year specification (1994).
Two-digit year codes from 00 through 40 represent
the years 2000 through 2040, respectively.
HP_SHLIB_VERSION assigns a version number based on date
to a module in a shared library. The version number applies to
all global symbols defined in the module's source file.
This pragma should only be used if incompatible changes are made to a source
file. If a version number pragma is not present in a source file, the
version number of all symbols defined in the object module defaults to 1/90.
#pragma COPYRIGHT "string"string is the set of characters included in the copyright message in the object file.
If no date is specified (using pragma
COPYRIGHT_DATE), the current year
is used in the copyright message.
#pragma COPYRIGHT "Acme Software"
places the following string in the object code:
(C) Copyright Acme Software, 1997. All rights reserved. No part of this program may be photocopied, reproduced, or transmitted without prior written consent of Acme Software.
The following pragmas
#pragma COPYRIGHT_DATE "1990-1997" #pragma COPYRIGHT "Brand X Software"
place the following string in the object code:
(C) Copyright Brand X Software, 1990-1997. All rights reserved. No part of this program may be photocopied, reproduced, or transmitted without prior written consent of Brand X Software.
NOTE: To see the COPYRIGHT string as well as any other strings in the object file, use the strings(1) command with the -a option for example:
#pragma COPYRIGHT_DATE "string"string is a date string used by the COPYRIGHT pragma.
Use the COPYRIGHT pragma to put the copyright
message into the object file.
#pragma COPYRIGHT_DATE "1988-1992"Places the string "1988-1992" in the copyright message.
NOTE: To see the COPYRIGHT_DATE string as well as any other strings in the object file, use the strings(1) command with the -a option for example:
#pragma LOCALITY "string"string specifies a name to be used for a code subspace.
All code following the LOCALITY pragma is associated with the name
specified in string. Code that is not headed by a LOCALITY pragma is
associated with the name $CODE$.
The smallest scope of a unique LOCALITY pragma is a function.
#pragma LOCALITY "MINE"Builds the name
$CODE$MINE$ and associates all code following this pragma
with this name, unless another LOCALITY pragma is encountered.
#pragma VERSIONID "string"string is a string of characters that HP aC++ places in the object file.
Places the characters Software Product, Version 12345.A.01.05 into the
object file.
NOTE: To see the VERSIONID string as well as any other strings in the object file, use the strings(1) command with the -a option for example:
strings -a ObjectFileName.o