[Revisit.SolidMCP] 写不会惹麻烦的宏

在写C++宏的时候,通常不注意,在使用时会人来一些麻烦。有的人会在用()把宏包含起来,虽然好些,在有些情况还是会出错.

一个比较好的办法是用do { … } while(0)这种形式:

#define SMCP_ASSERT(des)   do { assert(des); } while(0)

posted on 2011-07-09 18:07  飘行天下  阅读(142)  评论(0编辑  收藏  举报

导航