Date: Mon, 09 Jun 2025 15:43:58 -0300
On Monday, 9 June 2025 14:36:50 Brasilia Standard Time Andrey Semashev via
Std-Proposals wrote:
> On 9 Jun 2025 18:20, Andre Kostur via Std-Proposals wrote:
> > Food for thought: there may be a silent performance degradation if
> > such a constructor were to "accidentally" get a noexcept(false)
> > function call somewhere. Or some member variable (or
> > member-of-a-member, etc) loses its noexcept(true) status.
>
> Losing performance would be better than silently introducing a code path
> that ends with std::terminate(). Also, you can test that your function
> marked as noexcept(auto) remains noexcept(true) in tests, but you can't
> test that your function marked as noexcept(true) doesn't actually call
> std::terminate if something within it becomes potentially throwing.
On the other hand, you may be calling noexcept(false) functions in your code
but know that they can't throw (almost any C function, for example). In this
case, you must keep marking your function noexcept.
Std-Proposals wrote:
> On 9 Jun 2025 18:20, Andre Kostur via Std-Proposals wrote:
> > Food for thought: there may be a silent performance degradation if
> > such a constructor were to "accidentally" get a noexcept(false)
> > function call somewhere. Or some member variable (or
> > member-of-a-member, etc) loses its noexcept(true) status.
>
> Losing performance would be better than silently introducing a code path
> that ends with std::terminate(). Also, you can test that your function
> marked as noexcept(auto) remains noexcept(true) in tests, but you can't
> test that your function marked as noexcept(true) doesn't actually call
> std::terminate if something within it becomes potentially throwing.
On the other hand, you may be calling noexcept(false) functions in your code
but know that they can't throw (almost any C function, for example). In this
case, you must keep marking your function noexcept.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Platform & System Engineering
Received on 2025-06-09 18:44:05