Y
Hacker News
new
|
ask
|
show
|
jobs
by
Liquid_Fire
1953 days ago
I don't advocate the use of this macro, but if you do use it you should really wrap the parameters and the whole expression in parentheses to avoid precedence issues:
#define TERN(c, a, b) ((c) ? (a) : (b))
1 comments
sophistc
1953 days ago
Exactly, this is C macro 101.
link