#ifdef HALNODEBUG
#define HAL_ASSERT(expr)
#define HAL_ASSERT_FORCED()
#define HAL_ASSERT_STATEMENT(statement)
#define HAL_ASSERT_DECLARATION(declaration)
#else
#define HAL_ASSERT(expr) st( if (!( expr )) halAssertHandler(); )
#define HAL_ASSERT_FORCED() halAssertHandler()
#define HAL_ASSERT_STATEMENT(statement) st( statement )
#define HAL_ASSERT_DECLARATION(declaration) declaration
#endif
如果定了HALNODEBUG宏, 则:
#define HAL_ASSERT(expr)
#define HAL_ASSERT_FORCED()
#define HAL_ASSERT_STATEMENT(statement)
#define HAL_ASSERT_DECLARATION(declaration)
这个define是什么意思? 没有任何操作的意思吗?
Viki Shi:
assert的定义和使用请参考此文档:http://blog.csdn.net/hpuyancy/article/details/7585530
cedar_xuesong:
嗯,NODEBUG表示禁用assert宏,也就是空操作,不会弹出任何报警和打印错误信息