D.1. Introduction
This chapter introduces the preprocessor.
Preprocessing occurs before a program is compiled. Some possible actions are
inclusion of other files in the file being compiled, definition of symbolic
constants and macros, conditional compilation of
program code and conditional execution of preprocessor
directives. All preprocessor directives
begin with #, and only whitespace
characters may appear before a preprocessor directive on a line. Preprocessor
directives are not C++ statements, so they do not end in a semicolon
(;). Preprocessor directives are processed fully before compilation
begins.
Common Programming Error D.1
|
Placing a
semicolon at the end of a preprocessor directive can lead to a variety of
errors, depending on the type of preprocessor
directive. |
Software Engineering Observation D.1
|
Many
preprocessor features (especially macros) are more appropriate for C programmers
than for C++ programmers. C++ programmers should familiarize themselves with the
preprocessor, because they might need to work with C legacy
code. |