noexcept is
not controversial| Document #: | P4257R0 [Latest] [Status] |
| Date: | 2026-06-08 |
| Project: | Programming Language C++ |
| Audience: |
LEWG |
| Reply-to: |
Nevin “:-)” Liber <nliber@anl.gov> |
First proposed.
For C++11, LWG (there was no LEWG) was being very arbitrary about
which non-throwing functions to mark
noexcept.
Then in Madrid, the final meeting for technical work on C++11, along
came N3279 Conservative use of
noexcept in
the Library, eventually to become known as the Lakos Rule. One of
its guidelines is:
noexcept.In Varna, we discovered that the Lakos Rule was never voted on as a policy past C++11.
Since then, there has been no policy regarding
noexcept in
the standard library.
In the discussions since then, it seems that all of the policy
proposals have marking wide contract (no preconditions) non-throwing
functions
noexcept.
This is clearly better than the status quo of having no policy.
If we cannot come to consensus on anything else regarding
noexcept,
then we should at least attempt to come to consensus on this.
Policy: Each library function having a wide contract, that LEWG agree
cannot throw, should be marked as unconditionally
noexcept.
Thanks to John Lakos and Alisdair Meredith for initially bringing
some sanity to marking functions
noexcept.
Nevin Liber was supported by the Office of Science, U.S. Department of Energy, under contract DE-AC02-06CH11357.
noexcept
Prevents Library Validationnoexcept in
the Librarynoexcept
Policy, Rev0noexceptnoexcept
Policy Historynoexcept
policy for SD-9 (The Lakos Rule)