Cryptography Reference
In-Depth Information
else
{
cerr << "critical run-time error detected by the
class LINT:
\ n";
switch (error)
{
case E_LINT_DBZ:
cerr << "division by zero, function " << func;
cerr << ", line " << line << ", module " << file << endl;
#ifdef LINT_EX
throw LINT_DivByZero (func, line, file);
#endif
break;
// ...
}
}
}
The behavior that results in the case of an error can be completely controlled
by user-defined routines for error handling without the necessity of intervention
into the LINT implementation. Moreover, the exception handling can be
completely turned off, which is necessary when this mechanism is not supported
by a C++ compiler that is to be used. In the case of the present panic() function
the exceptions must be turned on explicitly via the definition of the macro
LINT_EX , such as with the compiler option -DLINT_EX . Some compilers require the
specification of additional options for exception handling to be activated.
To close, we present a small demonstration of the LINT exceptions:
#include "flintpp.h"
main(void)
{
LINTa=1,b=0;
try
{
b=a/b;// error: division by 0
}
catch (LINT_DivByZero error) // error handling for division by 0
{
error.debug_print ();
cerr << "division by zero in the module" << __FILE__
<< ", line " << __LINE__;
}
}
Search WWH ::




Custom Search