Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Liquid_Fire
· 5y ago · 0 comments
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))
Comments
[–]
sophistc
5y ago
Exactly, this is C macro 101.