cpp(1)cpp(1)NAMEcpp - the C language preprocessor
[option]... [ifile [ofile]]
is the C language preprocessor which is invoked as the first pass of
any C compilation using the command (see cc(1)). Its purpose is to
process and conditional compilation instructions and macros. Thus the
output of is designed to be in a form acceptable as input to the next
pass of the C compiler. As the C language evolves, and the rest of the
C compilation package will be modified to follow these changes. There‐
fore, the use of in other than this framework is not suggested. The
preferred way to invoke is through the command, since the functionality
of may someday be moved elsewhere. See m4(1) for a general macro pro‐
optionally accepts two file names as arguments. ifile and ofile are
respectively the input and output for the preprocessor. They default
to standard input and standard output if not specified.
The following options are recognized by
Remove all predefined symbols that begin with a letter and
The user is expected to define or when using this
By default, strips C-style comments. If the option is specified,
all comments (except those found on directive lines) are
Define name as if by a directive. If no is given, name
is defined as The option has lower precedence
than the option. Thus, if the same name is used
in both a option and a option, the name is unde‐
fined regardless of the order of the options.
Change the internal macro definition table to be
nnn bytes in size. The default buffer size is at
least 8188 bytes. This option serves to elimi‐
nate "Macro param too large", "Macro invocation
too large", "Macro param too large after substi‐
tution", "Quoted macro param too large", "Macro
buffer too small", "Input line too long", and
"Catenated input line too long" errors.
Generates included files and sents the results to the file
inclfile. If the argument inclfile is omitted,
the result is sent to the standard error.
Change the algorithm for searching for
files whose names do not begin with to look in
dir before looking in the directories on the
standard list. Thus, files whose names are
enclosed in double quotes ("") are searched for
first in the directory of the file containing the
line, then in directories named in options in
left-to-right order, and last in directories on a
standard list. For files whose names are
enclosed in angle brackets the directory of the
file containing the line is not searched. How‐
ever, directory dir is still searched.
Generates makefile dependencies and sends the results to the
makefile. If the argument makefile is omitted,
the result is sent to the standard error.
Preprocess the input
without producing the line-control information
used by the next pass of the C compiler.
HP-UX no longer restricts preprocessor symbols to eight
characters. The option forces to use only the
first eight characters for distinguishing differ‐
ent preprocessor names. This behavior is the
same as preprocessors on some other systems with
respect to the length of names, and is included
for backward compatibility.
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: Hardware: UNIX systems variant:
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 variable or other command-
line options to the C compiler at compile time
(see cc(1)). All HP-UX systems have the symbols
and defined. Each system defines at least one
hardware variant, as appropriate. The lint sym‐
bols are defined when lint(1) is running. See
Two special names are understood by is defined as the current
line number (as a decimal integer) as counted by is defined as
the current file name (as a C string) as known by They can be
used anywhere (including in macros) just as any other defined
All directives start with lines begun by Any number of blanks
and tabs are allowed between the and the directive. The direc‐
#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 corre‐
sponding 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, restarts its scan for names to
expand at the beginning of the newly created
Notice that there can be no space between name
#endif [text] Ends a section of lines begun by a test directive
or Each test directive must have a matching Any
text occurring on the same line as the is ignored
and thus may be used to mark matching pairs.
This makes it easier, when reading the source, to
match and directives with their associated direc‐
#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.
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
There is also a unary operator, which can be used
in constant-expression in these two forms: or
This allows the use of and in an directive.
Only these operators, integer constants, and
names that are known by should be used in con‐
stant-expression. In particular, the operator is
#ifdef name The lines following appear in the output if and
only if name has been the subject of a previous
without being the subject of an intervening
#ifndef name The lines following do not appear in the output
if and only if name has been the subject of a
previous without being the subject of an inter‐
Include at this point the contents of filename
(which are then run through See the option above
for more detail.
#line integer-constant "filename"
Causes to generate line-control information for
the next pass of the C compiler. integer-con‐
stant is the line number of the next line and
filename is the file where it comes from. If
filename and the quotation marks are omitted, the
current file name is unchanged.
#undef name Cause the definition of name (if any) to be for‐
gotten from now on.
The test directives and the possible directives can be nested.
supports names up to 255 characters in length.
The macro substitution scheme has been changed. Previous ver‐
sions of saved macros in a macro definition table whose table
size is 128000 bytes by default. The current version of
replaces this macro definition table with several small buffers.
The default size of the small buffers is 8188 bytes.
determines the interpretation of comments and string literals as
single- or multibyte characters.
determines the language in which messages are displayed.
If is not specified in the environment or is set to the empty
string, the value of is used as a default for each unspecified
or empty variable. If is not specified or is set to the empty
string, it defaults to "C" (see lang(5)). If any international‐
ization variable contains an invalid setting, behaves as if all
internationalization variables are set to "C". See environ(5).
International Code Set Support
Single- and multibyte character code sets are supported.
Error messages produced by are intended to be self-explanatory.
The line number and filename where the error occurred are
printed along with the diagnostic.
When newline characters were found in argument lists for macros
to be expanded, previous versions of put out the newlines as
they were found and expanded. The current version of replaces
these newlines with blanks to alleviate problems that the previ‐
ous versions had when this occurred.
The symbols and are not reserved symbols recognized by the
option. They are supplied to either automatically by the com‐
piler, or by the use of a compiler option. For example, on a
Series 700 system, the command:
(Also see the option of the command.)
Standard directory for