Cryptography Reference
In-Depth Information
Table 16-1.
LINT
function error codes
Code
Value
Explanation
E_LINT_OK
0x0000
everything ok
E_LINT_EOF
0x0010
file I/O error in the stream operator
<<
or
>>
E_LINT_DBZ
0x0020
division by zero
E_LINT_NHP
Heap error:
new
returns the NULL pointer
0x0040
E_LINT_OFL
0x0080
overflow in function or operator
E_LINT_UFL
0x0100
underflow in function or operator
E_LINT_VAL
0x0200
an argument of a function is uninitialized
or has an illegal value
E_LINT_BOR
0x0400
incorrect base passed as argument to a
constructor
E_LINT_MOD
even modulus in
mexpkm()
0x0800
E_LINT_NPT
0x1000
NULL pointer passed as argument
E_LINT_RIN
0x2000
call to an uninitialized pseudorandom number generator
16.2 User-Defined Error Handling
As a rule, it is necessary to adapt error handling to particular requirements. The
LINT
class offers support in this regard in that the
LINT
error function
panic()
can be replaced by user-defined functions. Additionally, the following function is
called, which takes as argument a pointer to a function:
void
LINT::Set_LINT_Error_Handler (void (*Error_Handler)
(LINT_ERRORS, const char*, int, int, const, char*))
{
LINT_User_Error_Handler = Error_Handler;
}
The variable
LINT_User_Error_Handler
is defined and initialized in
flintpp.cpp
as
static void (*LINT_User_Error_Handler)
(LINT_ERRORS, const char*, int, int, const char*) = NULL;
If this pointer has a value other than
NULL
, then the specified function is called
instead of
panic()
, and it contains the same information as
panic()
would have.
With respect to the implementation of a user-defined error-handling routine
one has a great deal of freedom. But one must realize that the errors reported by
the class
LINT
usually signal program errors, which are irreparable at run time. It