1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
<HTML>
<head><title>Debugging macros and functions</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="debugmacros"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx264.htm#functions"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx274.htm#logfunctions"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx276.htm#keycodes"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>Debugging macros and functions</H2>
<P>
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.<P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/debug.h><P>
<A HREF="#wxonassert">::wxOnAssert</A><BR>
<A HREF="#wxassert">wxASSERT</A><BR>
<A HREF="#wxassertmsg">wxASSERT_MSG</A><BR>
<A HREF="#wxfail">wxFAIL</A><BR>
<A HREF="#wxfailmsg">wxFAIL_MSG</A><BR>
<A HREF="#wxcheck">wxCHECK</A><BR>
<A HREF="#wxcheckmsg">wxCHECK_MSG</A><BR>
<P>
<HR>
<A NAME="wxonassert"></A>
<H3>::wxOnAssert</H3>
<P>
<B>void</B> <B>wxOnAssert</B>(<B>const char*</B><I> fileName</I>, <B>int</B><I> lineNumber</I>, <B>const char*</B><I> msg = NULL</I>)<P>
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).
<HR>
<A NAME="wxassert"></A>
<H3>wxASSERT</H3>
<P>
<B></B> <B>wxASSERT</B>(<B></B><I>condition</I>)<P>
Assert macro. An error message will be generated if the condition is FALSE.<P>
<HR>
<A NAME="wxassertmsg"></A>
<H3>wxASSERT_MSG</H3>
<P>
<B></B> <B>wxASSERT_MSG</B>(<B></B><I>condition</I>, <B></B><I>msg</I>)<P>
Assert macro with message. An error message will be generated if the condition is FALSE.<P>
<HR>
<A NAME="wxfail"></A>
<H3>wxFAIL</H3>
<P>
<B></B> <B>wxFAIL</B>(<B></B><I>condition</I>)<P>
Will always generate an assert error if this code is reached (in debug mode).<P>
<HR>
<A NAME="wxfailmsg"></A>
<H3>wxFAIL_MSG</H3>
<P>
<B></B> <B>wxFAIL_MSG</B>(<B></B><I>condition</I>, <B></B><I>msg</I>)<P>
Will always generate an assert error with specified message if this code is reached (in debug mode).<P>
<HR>
<A NAME="wxcheck"></A>
<H3>wxCHECK</H3>
<P>
<B></B> <B>wxCHECK</B>(<B></B><I>condition</I>, <B></B><I>retValue</I>)<P>
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.<P>
<HR>
<A NAME="wxcheckmsg"></A>
<H3>wxCHECK_MSG</H3>
<P>
<B></B> <B>wxCHECK_MSG</B>(<B></B><I>condition</I>, <B></B><I>retValue</I>, <B></B><I>msg</I>)<P>
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.<P>
</BODY></HTML>
|