标题: c code #define MAX(a, b) ((a)>(b)?(a):(b)) [打印本页] 作者: DDD888 时间: 3-8-2016 19:38 标题: c code #define MAX(a, b) ((a)>(b)?(a):(b)) I forgot what is the advantage of this macro #define MAX(a, b) ((a)>(b)?(a)b)) vs #define MAX(a, b) (a>b?a:b)
Thanks in advance 作者: ubuntuhk 时间: 4-8-2016 00:28
如果a,b分别是单个变量,没什么区别,如果是a,b本身是表达式,前者可以避免一些歧义引起的潜在错误。