I know the basic rules, use inline
, enum
and const
instead of #define
, that is not what I'm after with this question. What I want to know is what is considered an acceptable scenario in which you would use a #define
macro, and how, in C++.
Please do not post question or links to "define vs const" questions or "preprocessor vs compiler", and I've already gone through Effective C++ by Scott Meyers and I know the advantages of one over the other.
However after hours and hours of surfing the net, I get the feeling #define is treated as some kind of underdog in C++, but I'm sure there must be a case in which it could be acceptable, even desirable, to use it.
To get the ball rolling I guess one scenario I could think of is to create a DEBUG
macro that based on it enables prints and whatnot all over the code for debug purposes.