I was reading this tutorial of stanford where they say :
Common coding mistakes:
Bad parentheses in macro definition
#define mi
The first version fails if you combine it with other operators:
min(a , b) + c
and translates to:
a
which is identical to:
a
which is an unexpected outcome given the starting parenthesis.
The second version isn't much better. It evaluates one of the parameters twice which can cause unexpected behavior if a function or i++
is passed to the macro.
An inline function should be used instead of those macros.