HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)

c
cpp(1) cpp(1)
-Uname Remove any initial definition of name, where name is a reserved symbol that is predefined
by the particular preprocessor. The current list of these symbols includes:
Operating system:
unix _ _unix
Hardware: hp9000s200 hp9000s300 _ _hp9000s300
hp9000s500 hp9000s800 _ _hp9000s800
hp9000ipc hppa _ _hppa
_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 defined by the
CCOPTS variable
or other command-line options to the C compiler at compile time (see cc(1)). All HP-UX
systems have the symbols
PWB, hpux
, unix, _PWB, __hpux, and __unix defined.
Each system defines at least one hardware variant, as appropriate. The lint symbols are
defined when lint(1) is running. See DEPENDENCIES.
Two special names are understood by
cpp. __LINE__ is defined as the current line number (as a decimal
integer) as counted by cpp. __FILE__ is defined 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 defined 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-string can 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-string is
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-string
unchanged. After the entire token-string has 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 direc-
tives 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-expression evaluates 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 defined by the C language.
There is also a unary operator, defined, which can be used in constant-expression in
these two forms: defined(name) or defined name. This allows the use of #ifdef
and #ifndef in an #if directive.
166 Hewlett-Packard Company 2 HP-UX 11i Version 3: February 2007