[OpenWalnut-Dev] the WAssert macro
reichenbach at informatik.uni-leipzig.de
reichenbach at informatik.uni-leipzig.de
Tue Mar 23 13:20:00 CET 2010
Hello,
revision 1698 (b9d2067c708a) adds the macro WAssert, that can be used to
perform run-time checks on your data.
To use the macro, common/WAssert.h needs to be included in your .cpp.
If WASSERT_AS_CASSERT is defined before including the header, the
macro will act like a c-assertion, else a WException will be thrown.
In the current implementation, the macro has 2 parameters. The first is an
expression that can be evaluated to a boolean value. The second one is
an optional message. If you do not want to add a message, simply set
the second
parameter to "".
In any case, the expression that failed as well as the position of the WAssert
statement (file and line number) are reported.
Example:
WAssert( true == false, "" );
WAssert( someboolean == true, "This is an example." );
Best Regards,
André
More information about the OpenWalnut-Dev
mailing list