C/C++: What are your favorite clever/brilliant/useful/elegant examples of
preprocessor macros?
I'm a new C++ programmer coming from Java and I'm already in love with
macros - they make coding so simple and elegant. I've been using them for
basic things like debugging and a loop which iterates over two integers
(that is, two for loops compressed into one line). I'd like to hear more
clever tricks that can be done!
(Yes, I'm aware that macros can be dangerous, but I think I'm willing to
take that risk. My IDE makes it very easy to see what the macros expand
out to so I don't think it's a huge problem.)
No comments:
Post a Comment