Chapter 16. Error Handling
O hateful error, melancholy's child!
(Don't) Panic ...
The C++ functions presented in the foregoing chapters embody mechanisms for analyzing whether during the execution of a called C function an error or other situation has occurred that requires a particular response or at least a warning. The functions test whether the passed variables have been initialized and evaluate the return value of the called C functions:
LINT f (LINT arg1, LINT arg2) { LINT result; int err; if (arg1.status == E_LINT_INV) LINT::panic (E_LINT_VAL, "f", 1, __LINE__); if (arg2.status == E_LINT_INV) LINT::panic (E_LINT_VAL, "f", 2, __LINE__); // Call C function to execute operation; error code is stored in err err = f_l ...
Get Cryptography in C and C++, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.