May 2002
Beginner
320 pages
6h 18m
English
If you take a high-level look at the example you've been building, you can see that error-handling code now dominates it. While this is not unusual for professional programs, it is inconvenient to have error-handling code interlaced with normal processing code. You might also notice that the two else blocks contain essentially the same error-handling code.
Earlier forms of the example took some steps to separate the error and non-error code by using the bang operator to keep the normal processing code near the top and error-processing code near the bottom.
However, C++ offers a better way to deal with errors, called exception handling. Under exception handling, code that encounters an error throws an exception, ...
Read now
Unlock full access