Deep C Secrets . Prentice-Hall, Englewood Cliffs, New Jersey. The discussion of setjmp and longjmp comes from this book, and does not appear in Deitel and Deitel. Often, when writing code, we include code to detect and handle errors at the place in the code where the error might occur.
Exception handling is useful for situations in which the program can recover from the error.
It is also useful for situations in which the program cannot recover from the error, but can shut down gracefully. While it is possible to use it to control the flow of program control, it is an amazingly bad idea. Exception handling, as we will see, is based ultimately on something like the goto command. Also, we have all written code that ignored exceptions, sometimes intentionally. Before discussing some error-handling techniques, we discuss the use of the keyword goto as background.