HP aC++ predefines the following predicates:
•#assert system(unix)
•#assert model(lp64) // when +DA2.0W is used
•#assert model(ilp32) // default
•#assert endian(big)
Example:
int main()
{
#assert dimensions(three) // Set predicate and token to true. #if #dimensions(two)
#error "May not compile in 2 dimensions" #endif
#if #dimensions(three) int x, y, z;
#endif
#unassert dimensions | // Set predicate and all tokens to false. |
} |
|
Conditional Compilation (#if, #ifdef, .. #endif)
Conditional compilation directives allow you to delimit portions of code that are compiled only if a condition is true.
Syntax
#if | |
#ifdef | identifier newline [group] |
#ifndef | identifier newline [group] |
#else | newline [group] |
#elif | |
#endif |
|
Here,
defined identifier
defined (identifier)
The
Description
You can use #if, #ifdef, or #ifndef to mark the beginning of the block of code that will only be compiled conditionally. An #else directive optionally sets aside an alternative group of statements. You mark the end of the block using an #endif directive.
The following #if directive illustrates the structure of conditional compilation:
#if
...
(Code that compiles if the expression evaluates to a nonzero value.)
...
#else
...
(Code that compiles if the expression evaluates to zero.)
126 Preprocessing Directives