Cryptography Reference
In-Depth Information
If the variable
status
contains the value
E_LINT_OK
, then this is the optimal
case. In less happy situations, in which overflow or underflow has occurred in
a C function, the variable
status
is set to the appropriate value
E_LINT_OFL
or
E_LINT_UFL
. Since our C functions already react to an overflow or underflow with
a reduction modulo
N
max
+1
(cf. page 20), in such cases the functions terminate
normally. The value of the variable
status
can then be queried with the member
function
LINT_ERRORS LINT::Get_Warning_Status (void);
Furthermore, we have seen that the
LINT
functions always call a function with
the well-chosen name
panic()
when the situation gets too hot to handle. The task
of this member function is first of all to output error messages, so that the user of
the program is made aware that something has gone awry, and secondly to ensure
a controlled termination of the program. The
LINT
error messages are output
via the stream
cerr
, and they contain information about the nature of the error
that has occurred, about the function that has detected the error, and about the
arguments that have triggered the error. In order that
panic()
be able to output all
of this information, such information arriving from the calling function must be
delivered, as in the following example:
LINT::panic (E_LINT_DBZ, "%", 2, __LINE__);
Here it is announced that a division by zero in the operator “
%
” has appeared in
the line specified by the ANSI macro
__LINE__
, caused by the operator's argument
number 2. The arguments are indicated as follows: 0 always denotes the implicit
argument of a member function, and all other arguments are numbered from left
to right, beginning with 1. The
LINT
error routine
panic()
outputs error messages
of the following type:
Example 1:
Use of an uninitialized
LINT
object as argument.
critical run-time error detected by class LINT:
Argument 0 in Operator *= uninitialized, line 1997
ABNORMAL TERMINATION
Example 2:
Division by a
LINT
object with the value
0
.
critical run-time error detected by class LINT:
Division by zero, operator/function/, line 2000
ABNORMAL TERMINATION
The functions and operators of the
LINT
class recognize the situations listed
in Table 16-1.