Chapter 10. The C++ Preprocessor
The speech of man is like embroidered tapestries, since like them
this has to be extended in order to display its patterns, but when it
is rolled up it conceals and distorts them.
—Themistocles
The first
C compilers had no constants or
inline functions. When C was still being developed, it soon became
apparent that it needed a facility for handling named constants,
macros, and include files. The solution was to create a preprocessor
that is run on the programs before they are passed to the C compiler.
The preprocessor is nothing more than a specialized text editor. Its
syntax is completely different from C's, and it has
no understanding of C constructs. It is merely a dumb text editor.
The preprocessor was soon merged into the main C compiler. The C++
compiler kept this preprocessor. On some systems, such as Unix, it is
still a separate program, automatically executed by the compiler
wrapper cc. Some of the newer compilers, such as
Borland-C++ Builder, have the preprocessor built in.
|