Q&A

Q1:If C++ offers better alternatives than the preprocessor, why is this option still available?
A1: First, C++ is backward compatible with C, and all significant parts of C must be supported in C++. Second, there are some uses of the preprocessor that are still employed frequently in C++, such as inclusion guards.
Q2:Why use macro functions when you can use a regular function?
A2: Macro functions are expanded inline and are used as a substitute for repeatedly typing the same commands with minor variations. However, templates offer a better alternative.
Q3:What is the alternative to using the preprocessor to print interim values during debugging?
A3: The best alternative is to use watch statements within a debugger. For information on watch ...

Get Sams Teach Yourself C++ in 24 Hours, Third 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.