/** * 书本:【ThinkingInC++】 * 功能:关于宏的使用,探讨使用宏的缺点 * 时间:2014年9月11日07:50:54 * 作者:cutter_point */ #include"../require.h" #includeusing namespace std; //这里就是用BAND(x)代替后面的那一串函数 #define BAND(x) (((x)> 5 && (x)<10) ? (x) : 0) int main() { ofstream out("macro.txt"); assure(out, "macro.txt"); for(int i=4 ; i < 11 ; ++i) { int a=i; out<<"a= "< 5 && (++a)<10) ? (++a) : 0)这里调用了三次++a, //好的,代码一旦执行,问题马上就体现出来了 out<<"BAND(++a)="<