#define max(a,b) ((a) > (b) ? (a) : (b))
This definition computes either a or b twice, with bad results if the operand has side effects(边际效应).
side effects可以理解成副作用,
当如下调用该宏时:max(a++,b++),宏被替换成 ((a++)>(b++)?(a++): (b++)),所以肯定有个变量被计算2次
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。