i have a macro for checking and han开发者_运维技巧dling errors
#define ERROR_IF_ARG(x, y, z, w)\
if (x) {\
printf("\nERROR! {\n\tText : " y "\n\tExpression : (" #x ")\n\tIn file : %s\n\tLine : %d\n\tFunction : %s\n}\n\n", z, __FILE__, __LINE__, __func__);\
w;\
}
in code i call
ERROR_IF_ARG(!isOfType(UNI_STRING), "expected 'std::string', found '%s' ", UNITYPE2STR(type), return NULL);
sadly i cannot place breakpoints inside this macro, but is there maybe some way with using #pragma or __ to place a breakpoint mark by code? or else generate and interuption, so i can trace the problem
Obviously you're running in a debugger if you're looking to use breakpoints; how about using an assert within the macro?
精彩评论