December 2001
Intermediate to advanced
304 pages
6h 25m
English
Difficulty: 4
What can and can't macros do? Not all compilers agree.
Demonstrate how to write a simple max() preprocessor macro that takes two arguments and evaluates to the one that is greater, using normal < comparison. What are the usual pitfalls in writing such a macro?
What can a preprocessor macro not create? Why not?
1. Demonstrate how to write a simple max() preprocessor macro that takes two arguments and evaluates to the one that is greater, using normal < comparison. What are the usual pitfalls in writing such a macro?
There are four major pitfalls, in addition to several further drawbacks. ...
Read now
Unlock full access