O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

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

13.7. Unexpected Exceptions

Exception specifications state which exceptions a function may throw, either directly or indirectly. When a function throws an exception that does not appear in the function's exception specification, the exception is unexpected. By default, the exception mechanism calls unexpected(), which calls terminate() to stop your program. This section explores unexpected exceptions in more detail and shows you strategies for handling them in applications.

The unexpected() Function

The exception mechanism calls unexpected() for thrown exceptions that do not appear in a function's exception specification. The unexpected() function executes abort(), which terminates your program without calling any object destructors. The set_unexpected() ...

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