HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
NOTE: Note: Do not enable the HP_NONSTD_FAST_IOSTREAM macro in any of the
following cases:.
• If the application assumes a C++ stream to be in sync with a C stream.
• If the application depends on stream flushing behavior with endl.
• If the user uses "std::cout.unsetf(ios::unitbuf)" to unit buffer the output
stream.
Pragma Directive (#pragma) and _Pragma Operator
A #pragma directive is an instruction to the compiler. Use a pragma to control the actions
of the compiler in a particular portion of a program without affecting the program as a
whole.
Syntax
pragma-directive ::=
#pragma [token-list]
Description
The #pragma directive is ignored by the preprocessor, and instead is passed on to the
HP aC++ compiler. It provides implementation-dependent information to HP aC++. Any
pragma that is not recognized by HP aC++ will generate a warning from the compiler.
The _Pragma operator, supported in non-strict C++98/C++03 mode and in all C++0x
modes, has the effect of expanding the pragma specified in the string (in double-quotes)
in just the way a #pragma directive would. For example:
_Pragma ("pack 1");
struct Packed {
char c;
int i;
};
int main () {
int iPackedSize = sizeof(Packed);
}
See Chapter 3 (page 116) for more information on pragmas.
Example
#pragma OPTIMIZE ON
Error Directive (#error)
The #error directive causes a diagnostic message, along with any included token
arguments, to be produced by HP aC++.
160 Preprocessing Directives