#define MLA_ASSERT(expr) (void)((!!(expr)) || (printf("mla assert fail: \"%s\" @ %s, %u", #expr, __FILENAME__, __LINE__), printf("\r\n"), abort()
// usage:
MLA_ASSERT(pointer != NULL)
#define MLA_ASSERT(expr) (void)((!!(expr)) && (printf("mla assert fail: \"%s\" @ %s, %u", #expr, __FILENAME__, __LINE__), printf("\r\n"), abort()
// usage:
MLA_ASSERT(pointer == NULL)
// 返回值是最后一个参数,只会是0或1
#define MLA_ASSERT(expr) (int)((!!(expr)) || (printf("mla assert fail: \"%s\" @ %s, %u", #expr, __FILENAME__, __LINE__), printf("\r\n"), 0))
// usage:
if (!MLA_ASSERT(pointer != NULL)) {
return;
}
#define MLA_ASSERT(expr) (int)((!!(expr)) && (printf("mla assert fail: \"%s\" @ %s, %u", #expr, __FILENAME__, __LINE__), printf("\r\n"), 0))
// usage:
if (!MLA_ASSERT(pointer == NULL)) {
return;
}
标签:__,ASSERT,MLA,实现,expr,C++,assert,printf From: https://www.cnblogs.com/skullboyer/p/17318411.html