我发现这个代码from here这个rsAssert宏的含义是什么?
#if 1
#define rsAssert(v) do {if(!(v)) LOGE("rsAssert failed: %s, in %s at %i", #v, __FILE__, __LINE__);} while(0)
#else
#define rsAssert(v) while(0)
#endif
问题1:
这里我没有得到为什么do and while
在这里使用?有什么特别的理由使用它?
问题2:
是什么做的这一切在宏的目的。为什么只有一个不使用assert()
?
我想也许有这个正当的理由..
+1表示assert()会中止程序,并且此宏不会.. !!! – 2012-02-20 17:33:48