Preprocessor Directives

In most other languages, what you write in the source file is what the compiler sees during compilation. This is not the case in C++. The compiler is not the first tool that deals with the source code on its way to becoming an executable program. The first tool that processes the source code is the preprocessor. What is this? Well, it is an interesting invention that C++ inherited from C. Its goal is to decrease the amount of source code that the programmer writes during development (or reads during debugging or maintenance).

The preprocessor processes the source file and passes the results of processing to the compiler for compilation. Most of the program statements are ignored by the preprocessor and are passed to the ...

Get Core C++ A Software Engineering Approach 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.