带参数的宏定义应该怎么写,参数不能加括号
2013-09-19 20:48:21
如下,宏定义带参数时,宏名中参数不能加括号:
1 //对于带参数的宏定义,参数不能加括号,提示'(' : unexpected in macro formal parameter list 2 //#define MAX((a),(b)) ( (long)((a) - (b)) & (0x1 << (8*sizeof(long) - 1) ) ? (b) : (a) ) 3 4 #define MAX(a,b) ( (long)((a) - (b)) & (0x1 << (8*sizeof(long) - 1) ) ? (b) : (a) )