Chapter 12. Exceptions and a Look Forward to Contracts

Images

Objectives

In this chapter, you’ll:

Understand the exception-handling flow of control with try, catch and throw.

Provide exception guarantees for your code.

Understand the standard library exception hierarchy.

Define a custom exception class.

Understand how stack unwinding enables exceptions not caught in one scope to be caught in an enclosing scope.

Handle new dynamic memory allocation failures.

Catch exceptions of any type with catch(...).

Understand what happens with uncaught exceptions.

Understand which exceptions should not be handled and which cannot be handled.

Get C++20 for Programmers, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.