C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Mark std::assume_aligned as noexcept

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 29 Jun 2025 09:52:33 -0400
On Sun, Jun 29, 2025 at 6:06 AM Tymi via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Another smaller reason to use this function is noexcept functions, because some static analysers are not happy with using not noexcept functions in noexcept context...

This seems to be a semi-common misuse of the feature, where people (or
people who write static analysis tools) assume that it is incorrect
programming for it to be theoretically possible for an exception to
attempt to escape a `noexcept` function. That is not how the feature
works (an exception attempting to escape a `noexcept` function has
well-defined behavior), and it's not something that static analysis
tools should be trying to impose unless the user specifically asked to
do that.

I'm not conceptually against making this function `noexcept`, but
appeasing bad static analysis tools isn't a good reason to do it.

Received on 2025-06-29 13:52:45