Re:Where the Printf Rubber Meets the Road (2010)
by zem on Saturday October 04, 2014 @08:42PM
(#8411077)
the very few times you want the source to something to debug it etc. you'll have a hard time. the 99% of the time when you want not the implementation details but some semantically meaningful mapping of one token to one concept, macros are wonderful.
another huge benefit is that they take care of fiddly bookkeeping for you - if you have to remember some incantation that involves doing several steps in sequence and making sure that if you change place A you need to change B and C in certain ways, just write a macro and be happy.
I'm sure there is some political reason why ldbl_strong_alias was used to rename printf to __printf, but frankly I don't really care, there are macros like that all over the C/C++ libraries that make finding the source for anything pure hell.
The only acceptable macro to me now is a block which only runs in the DEBUG build and is skipped over by the compiler in RELEASE.
PS - Yes this is why I don't code in C/C++ very often. I'm currently playing with Go which has no concept of macros.