C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Preprocessor Directives and Macros
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
12-4
#error
#error
The #error directive allows you to force a compilation error and terminate
compilation.
preprocessor-tokens
specifies the tokens to be included in the message text.
Example
This example causes the string following #error to be printed as the error message:
#error This message will be issued by the compiler
#if, #elif, #ifdef, #ifndef, #else, and #endif
The four if directives, together with the #else and #endif directives, define the
bounds of an if section, which conditionally includes or excludes source text. An
if section consists of:
An if group, which is one of the four if directives followed by the source text that the
compiler is to include if the controlling condition is true
An optional else group, which is the #else directive followed by the source text
that the compiler is to include if the controlling condition is false
The #endif directive, which marks the end of the if section
The four if directives offer different controlling conditions:
#error preprocessor-tokens
#if Tests the value of a constant expression. If the value is nonzero, the
source text in the if group is included; otherwise, the source text in an
elif or else group, if present, is included.
#elif Tests the value of a constant expression. If the value is nonzero, the
source text in the elif group is included; otherwise, the source text in
the next elif or else group, if present, is included.
#ifdef Tests the existence of an identifier as a macro name. If the identifier
has been defined (using #define), the source text in the if group is
included; otherwise, the source text in the else group (if present) is
included.
#ifndef Tests the nonexistence of an identifier as a macro name. If the
identifier has not been defined, the source text in the if group is
included; otherwise, the source text in the else group (if present) is
included.