O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

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

Why Use Exceptions?

Exceptions may seem somewhat more technical than if statements, but they are the preferred way to handle errors in C++. Whereas older libraries used to report errors with “error codes,” most modern libraries throw exceptions instead.

In addition, exception handling cleans up the code. While error handling is an important component of any real program, programmers generally want to read normal processing code and error-handling code separately, because that makes each of them easier to understand. Exceptions provide the best way to accomplish this.

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