Useful macros and functins for error checking and defensive programming. ASSERTs are only compiled if __WXDEBUG__ is defined, whereas CHECK macros stay in release builds.
Include files
<wx/debug.h>
::wxOnAssert
wxASSERT
wxASSERT_MSG
wxFAIL
wxFAIL_MSG
wxCHECK
wxCHECK_MSG
void wxOnAssert(const char* fileName, int lineNumber, const char* msg = NULL)
This function may be redefined to do something non trivial and is called whenever one of debugging macros fails (i.e. condition is false in an assertion).
wxASSERT(condition)
Assert macro. An error message will be generated if the condition is FALSE.
wxASSERT_MSG(condition, msg)
Assert macro with message. An error message will be generated if the condition is FALSE.
wxFAIL(condition)
Will always generate an assert error if this code is reached (in debug mode).
wxFAIL_MSG(condition, msg)
Will always generate an assert error with specified message if this code is reached (in debug mode).
wxCHECK(condition, retValue)
Checks that the condition is true, returns with the given return value if not (FAILs in debug mode). This check is done even in release mode.
wxCHECK_MSG(condition, retValue, msg)
Checks that the condition is true, returns with the given return value if not (FAILs in debug mode). This check is done even in release mode.