#define some()
do {
do_somt_thing();
} while (0)
为什么这样用?
可以试一下,假如一个普通宏定义
#define some(x) Fun1(x);Fun2(x)
if(condition) some(x);
if(condition) Fun1(x); Fun2(x);
#define some(x) {Fun1(x);Fun2(x);}if(condition) some(x); else someelse(x);
if(condition)
{
Fun1(x);
Fun2(x);
};//多了个分号
else
someelse(x);
原文地址:http://blog.csdn.net/kangroger/article/details/41318613