The take-home message for programmers: Today, there is no need for
#define
ing "optimized" function-like macros (e.g.,
max(a,b)
) with their multiple-evaluation, precedence and semicolon problems. (They are still useful if you need access to compile-time macros such as
__LINE__
or
__FILE__
(see
assert()
) or when symbol concatenation or stringification is needed (e.g. for variable/code generation). —
Marcel Waldvogel 22 secs ago