Date: Fri, 16 Jan 2026 09:17:46 -0800
On Friday, 16 January 2026 08:37:18 Pacific Standard Time Andrey Semashev via
Std-Proposals wrote:
> > The reason is also that granting the implementation the freedom to not
> > copy around padding bytes is an optimization opportunity,
>
> The implementation cannot not copy the padding bits when the user
> invokes memcpy. It could theoretically do something funny with them when
> the user invokes bit_cast, but that is still acceptable if the result is
> usable (specifically, those bits of the result that were not produced
> from the input padding bits).
At least that appears to be the implementation for Clang and GCC. I don't know
whether this was intentional or not, though:
https://gcc.godbolt.org/z/Ef5vdve97
The memcpy() implementation copies all 16 bytes, padding bits and all. The
pure-assignment implementation copies 10 bytes. It might also normalise
negative zeroes or unnormal values, I don't remember.
Std-Proposals wrote:
> > The reason is also that granting the implementation the freedom to not
> > copy around padding bytes is an optimization opportunity,
>
> The implementation cannot not copy the padding bits when the user
> invokes memcpy. It could theoretically do something funny with them when
> the user invokes bit_cast, but that is still acceptable if the result is
> usable (specifically, those bits of the result that were not produced
> from the input padding bits).
At least that appears to be the implementation for Clang and GCC. I don't know
whether this was intentional or not, though:
https://gcc.godbolt.org/z/Ef5vdve97
The memcpy() implementation copies all 16 bytes, padding bits and all. The
pure-assignment implementation copies 10 bytes. It might also normalise
negative zeroes or unnormal values, I don't remember.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2026-01-16 17:17:59
