c

cpp(1)

 

 

 

cpp(1)

 

_PA_RISC1_0

_PA_RISC1_1

_SIO

_WSIO

UNIX systems variant:

hpux

_ _hpux

_HPUX_SOURCE

 

PWB

_PWB

 

 

lint(1):

lint

_ _lint

 

 

In addition, all symbols that begin with an underscore and either an upper-case letter or another underscore are reserved. Other symbols may be de®ned by the CCOPTS variable or other command-line options to the C compiler at compile time (see cc(1)). All HP-UXsystems have the symbols PWB, hpux, unix, _PWB, _ _hpux, and _ _unix de®ned. Each system de®nes at least one hardware variant, as appropriate. The lint symbols are de®ned when lint(1) is running. See DEPENDENCIES.

Two special names are understood by cpp. _ _LINE_ _ is de®ned as the current line number (as a decimal integer) as counted by cpp. _ _FILE_ _ is de®ned as the current ®le name (as a C string) as known by cpp. They can be used anywhere (including in macros) just as any other de®ned names.

Directives

All cpp directives start with lines begun by #. Any number of blanks and tabs are allowed between the # and the directive. The directives are:

#define name token-string

Replace subsequent instances of name with token-string. token-stringcan be null.

#define name(arg, ... , arg) token-string

Replace subsequent instances of name followed by a (, a list of comma-separated set of arguments, and a ) by token-string, where each occurrence of an arg in the token-stringis replaced by the corresponding set of tokens in the comma-separated list. When a macro with arguments is expanded, the arguments are placed into the expanded token-stringunchanged. After the entire token-stringhas been expanded, cpp restarts its scan for names to expand at the beginning of the newly created token-string.

Notice that there can be no space between name and the (.

#endif [text]

Ends a section of lines begun by a test directive (#if, #ifdef, or #ifndef). Each test directive must have a matching #endif. Any text occurring on the same line as the #endif is ignored and thus may be used to mark matching #if#endif pairs. This makes it easier, when reading the source, to match #if, #ifdef, and #ifndef directives with their associated #endif directive.

#elif constant-expression

Equivalent to:

#else

#if constant-expression

#else

Reverses the notion of the test directive that matches this directive. Thus, if lines previous to this directive are ignored, the following lines appear in the output, and vice versa.

#if constant-expression

The lines following appear in the output if and only if the constant-expressionevaluates to nonzero. All binary nonassignment C operators, the ?: operator, the unary -, !, and Ä operators are all legal in constant-expression. The precedence of the operators is the same as de®ned by the C language.

There is also a unary operator, defined, which can be used in constant-expressionin these two forms: defined(name) or defined name. This allows the use of #ifdef and #ifndef in an #if directive.

Only these operators, integer constants, and names that are known by cpp should be used in constant-expression. In particular, the sizeof operator is not available.

#ifdef name

Section 1122

− 2 −

HP-UX Release 11i: December 2000