Chapter 8. Preprocessor Directives

A directive—unlike a declaration or executable statement—is a general command to the compiler carried out by the preprocessor. The preprocessor decides which lines to compile; it also carries out search-and-replace on the source code before the rest of compilation takes place. Although the compiler never alters the original copies of the source files, the effect is as if the files were changed just prior to being compiled.

Probably the most essential directive is #include, which brings in a set of declarations from another file, saving the considerable work you’d do if you had to declare everything yourself.

Another use for directives is conditional compilation, which is a way to maintain different versions ...

Get C++ for the Impatient now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.