Embracing the **noexcept** Operator and Specifier *Safely*

By John Lakos

The noexcept operator, in concert with the noexcept specifier, enables generic code to choose a more efficient algorithm for types that have nonthrowing move and swap operations. These two C++11 features, which have continued to evolve with every release of the language since C++11, are important to high-performance computing yet, when overused, can profoundly jeopardize the maintainability of a large code base.

In this talk, we will explore what the noexcept keyword means, what it offers, how it can be used effectively, the potential pitfalls one can encounter (and how to avoid them), and some excruciating noexcept annoyances that exist in the C++ Standard today. Finally, we propose a fix for C++23 that will address several of the most egregious pitfalls and annoyances of these important features.

Background: Modern C++ offers a cornucopia of new features, not all of which are equally safe, especially when applied at scale. The material presented in this talk derives directly from our recently published book, Embracing Modern C++ Safely, wherein we categorize the features of modern C++ as safe, conditionally safe, or unsafe.