Date: Wed, 21 Jan 2026 08:35:22 -0800
On Wednesday, 21 January 2026 08:16:22 Pacific Standard Time Jan Schultke
wrote:
> > however
> > it is implemented, write zero for padding bits of its input. That includes
> > entire empty structs, if it is all padding.
>
> That's also what I'm suggesting, albeit as a separate function.
>
> > Ergo, if you want something that clears padding in-place, that requires a
> >
> > > std::clear_padding function, unless you treat std::bit_cast magically
> > > and
> > > give it custom ABI.
> >
> > I don't see why.
>
> Because the result of std::bit_cast has unspecified padding bits, so x =
Unless we change std::bit_cast, which is what I am proposing.
> std::bit_cast<X>(...) either makes the padding bits of x unspecified, or
> alternatively, has no effect in the first place because assignment
> operators do not modify padding.
wrote:
> > however
> > it is implemented, write zero for padding bits of its input. That includes
> > entire empty structs, if it is all padding.
>
> That's also what I'm suggesting, albeit as a separate function.
>
> > Ergo, if you want something that clears padding in-place, that requires a
> >
> > > std::clear_padding function, unless you treat std::bit_cast magically
> > > and
> > > give it custom ABI.
> >
> > I don't see why.
>
> Because the result of std::bit_cast has unspecified padding bits, so x =
Unless we change std::bit_cast, which is what I am proposing.
> std::bit_cast<X>(...) either makes the padding bits of x unspecified, or
> alternatively, has no effect in the first place because assignment
> operators do not modify padding.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2026-01-21 16:35:31
