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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.