O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, Third Edition by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required