Cryptography Reference
In-Depth Information
would make no sense to return to the program segment in which such an error
has occurred, and in general, in such cases the only reasonable course of action is
to terminate the program.
The return to the LINT error routine panic() is effected by a call to
LINT::Set_LINT_Error_Handler(NULL);
The following example demonstrates the integration of a user-defined
function for error handling:
#include "flintpp.h"
void my_error_handler (LINT_ERRORS err, const char* func,
int arg, int line, const char* file)
{
//... Code
}
main()
{
// activation of the user-defined error handler:
LINT::Set_LINT_Error_Handler (my_error_handler);
// ... Code
// reactivate the LINT error handler:
LINT::Set_LINT_Error_Handler (NULL);
// ... Code
}
16.3 LINT Exceptions
The exception mechanism of C++ is an instrument that is easier to utilize and
thereby more effective for error handling than the methods offered by C. The
error routine LINT::panic() described previously is limited to the output of
error messages and the controlled termination of a program. In general, we are
less interested in the division function in which a division by zero has occurred
than the function that has called the division and thereby precipitated the error,
information that LINT::panic() does not contain and thus cannot pass along.
In particular, it is impossible with LINT::panic() to return to this function in
order to remove an error there or to react in a way specific to the function. Such
possibilities, on the other hand, are offered by the exception mechanism of C++,
and we would like here to create the conditions that will make this mechanism
usable for the LINT class.
 
Search WWH ::




Custom Search