C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fixing std::bit_cast padding bit issues

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 16 Jan 2026 07:31:29 -0800
On Friday, 16 January 2026 06:55:42 Pacific Standard Time Andrey Semashev via
Std-Proposals wrote:
> This should not be the case. I believe, the reason for it being an UB
> was that integers used to allow trap values, which are no longer
> allowed. Certainly, not for raw bytes.

Signed integers did (and no longer do). But unsigned integers never allowed
them. And the std::uintXX_t ones don't allow padding bits at all (if the types
exist).

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-01-16 15:31:40