-
The use of macros is strongly discouraged. Avoid macros at all cost.
-
The preprocessor is just a stupid text replacement tool and should be avoided at all cost. It is completely unaware of type safety/type checking and not obeying scoping. Defined macros are not debuggable and sooner or later will lead to nasty side effects (e.g. multiple increment problem).
-
C++ provides vastly better tools for any imaginable use of macros; use inline functions or lambdas instead. The use of
#defineoutside of header include guards or conditional compilation has no place in modern C++ programming. -
Exception: A macro can still be useful (and the only way, unfortunately) to implement a custom assert() facility, when using the predefined macros FILE and LINE.
-