Appendix C. The C++ Preprocessor

The C/C++ preprocessor is an interesting part of C's history and has been kept in C++ as it developed from C. The preprocessor is not always considered a good thing in C++, and in fact Java, which aimed to correct many of C++'s “mistakes,” left out the preprocessor. C programmers do some old-fashioned things with this facility that are considered bad manners in C++, but the preprocessor quietly performs essential things and can occasionally be very useful. In this appendix I will show the full power of the preprocessor, and why some uses are considered bad practice.

Get C++ By Example: UnderC Learning Edition 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.