O'Reilly logo

Cryptography in C and C++, Second Edition by Michael Welschenbach

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 16. Error Handling

O hateful error, melancholy's child!

—Shakespeare, Julius Caesar

(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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required