© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
I. Horton, P. Van WeertBeginning C++23https://doi.org/10.1007/978-1-4842-9343-0_16

16. Runtime Errors and Exceptions

Ivor Horton1   and Peter Van Weert2
(1)
Stratford-upon-Avon, Warwickshire, UK
(2)
Kessel-Lo, Belgium
 

Exceptions are used to signal errors or unexpected conditions in a program. While other error-handling mechanisms do exist, exceptions generally lead to simpler, cleaner code, in which you are less likely to miss an error. Particularly in combination with the RAII principle (short for “resource acquisition is initialization”), we will show that exceptions form the basis of some of the most effective programming patterns in modern C++.

In this chapter, ...

Get Beginning C++23: From Beginner to Pro 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.