HP aC++/HP C A.06.25 Programmer's Guide

#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 127) 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++.
Syntax
error-directive ::=
#error [preprocessor tokens]
Example
// This directive will produce the diagnostic
// message "FLAG not defined!".
#ifndef FLAG
#error "FLAG not defined!"
#endif
// This directive will produce the diagnostic
// message "TABLE_SIZE must be a multiple of 256!".
#if TABLE_SIZE % 256 != 0
#error "TABLE_SIZE must be a multiple of 256!"
#endif
Overview of the Preprocessor 171