|
|
HP C++ Programmer's Guide: HP 9000 Series Workstations and Servers > Chapter 2 The HP C++ PreprocessorPreprocessing Directives |
|
This chapter presents information about the HP C++ preprocessor. If you are familiar with the HP C preprocessor described in the HP C/HP-UX Reference Manual, you may already be acquainted with some of this chapter's contents. A preprocessor is a text processing program that manipulates the text within your source file. You enter preprocessing directives into your source file to direct the preprocessor to perform certain actions on the source file. For example, the preprocessor can replace tokens in the text, insert the contents of other files into the source file, or suppress the compilation of part of the file by conditionally removing sections of text. It also expands preprocessor macros and conditionally strips out comments. The preprocessor program, Cpp.ansi, is invoked automatically when you compile your C++ source code. (You can use the -Ac option to invoke the compatibility mode preprocessor, Cpp.) When the preprocessor is finished, your preprocessed C++ code is passed to the HP C++ compiler. For more information on the phases of the compiler see Chapter 3 “Compiling and Executing HP C++ Programs”, "Compiling and Executing HP C++ Programs." HP C++ provides two modes of preprocessor operation: ANSI C mode and compatibility mode. ANSI C mode is the default. If you want the compatibility mode preprocessor, use the -Ac option of the CC command. Refer to "Compiling HP C Programs" in the HP C/HP-UX Reference Manual for further information on compatibility and ANSI C modes. Refer to "Compiling and Executing HP C++ Programs" in Chapter 3 “Compiling and Executing HP C++ Programs” of this manual for further information on CC options.
Preprocessing directives control the following general functions, each of which is discussed in subsequent sections:
The following lists rules and guidelines for using preprocessor directives:
The following are examples of preprocessing directives:
|
|