Date: Sun, 29 Jun 2025 12:47:20 +0100
On Sun, 29 Jun 2025, 11:06 Tymi via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> [ptr.align] specifies that `std::assume_aligned` throws *nothing*, so why
> isn't it already marked as `noexcept`?
>
Because it has a precondition.
Current signature:
> `template [[nodiscard]] constexpr T* assume_aligned(T* ptr);`
> Proposed signature:
> `template [[nodiscard]] constexpr T* assume_aligned(T* ptr) noexcept;`
>
> Impact on the standard: none
> Implementation: add noexcept specifier
>
> Reason: Better codegen on some compilers with exceptions (because of
> noexcept),
>
Have you verified this?
after all this function is meant to be an optimisation point. 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...
>
>
>
std-proposals_at_[hidden]> wrote:
> [ptr.align] specifies that `std::assume_aligned` throws *nothing*, so why
> isn't it already marked as `noexcept`?
>
Because it has a precondition.
Current signature:
> `template [[nodiscard]] constexpr T* assume_aligned(T* ptr);`
> Proposed signature:
> `template [[nodiscard]] constexpr T* assume_aligned(T* ptr) noexcept;`
>
> Impact on the standard: none
> Implementation: add noexcept specifier
>
> Reason: Better codegen on some compilers with exceptions (because of
> noexcept),
>
Have you verified this?
after all this function is meant to be an optimisation point. 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...
>
>
>
Received on 2025-06-29 11:47:42