13. Exception Handling

Don’t interrupt me while I’m interrupting.

– Winston S. Churchill

Error Handling

Exceptions; Traditional Error Handling; Muddling Through; Alternative Views of Exceptions; When You Can’t Use Exceptions; Hierarchical Error Handling; Exceptions and Efficiency

Exception Guarantees

Resource Management

Finally

Enforcing Invariants

Throwing and Catching Exceptions

Throwing Exceptions; Catching Exceptions; Exceptions and Threads

A vector Implementation

A Simple vector; Representing Memory Explicitly; Assignment; Changing Size

Advice

13.1. Error Handling

This chapter presents error handling using exceptions. For effective error handling, the language mechanisms must be used based on a strategy. Consequently, this ...

Get The C++ Programming Language, 4th 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.