#include <qgarlib/assert.H>
Assertions are compiled into a program:
... #define QGARDEBUG // To be imperatively placed ahead of the #include below ... ... #include <qgarlib/assert.H> ...
Assertions are used in a similar way as standard macro assert() (see standard header file assert.h).
void qgarAssert(int EX)
If EX is false, print a diagnostic message on the standard error output and abort.
Execution of a user-defined function may be substituted for abortion: See macro setQgarAssertHandler.
void qgarAssertAndEval(EX, EX2)
Same as qgarAssert(EX), but EX2 is evaluated before abortion.
void qgarAssertAndCatch(EX, EX2)
Same as qgarAssertAndEval(EX, EX2), but does not abort: Execution proceeds sequentially when returning from the macro.
void setQgarAssertHandler(void (*HANDLER)(int))
Substitute the execution of a user-defined function for abortion in case of assertion failer. The function must conform to the following pattern:
#include <qgarlib/assert.H> ... void userHandler(int i) { signal(SIGABRT, SIG_IGN); ... ... // user-specific code ... signal(SIGABRT, userHandler); }
void resetQgarAssertHandler()
Restore abortion in case of assertion failer. See macro setQgarAssertHandler.
Modules | |
| Auxiliaries | |