Well, if you have to do this (and there are some cases where you could), then you should at least define the macro as “functional”, thus:
#define SOME_FUNCTION() someFunction(defaultArgument)
otherwise, you should write code that looks like assigning a constant when it was a function call; i.e;
x = SOME_FUNCTION ; // hidden function call
but with a “functional” macro that you would have to write:
x = SOME_FUNCTION() ; // shorthand function-call with default argument
Which better matches the syntax of the preprocessor with the syntax of the language.
Generally, macros like functions are best avoided, but some are more insidious, others are by no means the worst case. However, you can just as easily write the shell of functions in C, or in C ++ use the default argument, and that would be preferable in most cases.
Clifford
source share