Subject: Re: [std-proposals] P1839 and the object representation of subobjects
From: Jason McKesson (jmckesson_at_[hidden])
Date: 2020-07-21 11:37:08
On Tue, Jul 21, 2020 at 11:56 AM Thiago Macieira via Std-Proposals
> On Tuesday, 21 July 2020 08:01:13 PDT Jason McKesson via Std-Proposals wrote:
> > ```
> > auto byte_ptr = reinterpret_cast<byte *>(qoptr);
> > auto c1ptr = std::launder(reinterpret_cast<C1 *>(qoptr + off);
> > ```
> > If there is an object of type `C1` at the given address, then
> > `std::launder` will return a pointer to it. This is the purpose of
> > `launder`.
> There is an object of the proper type at the address. The problem is we can't
> get to the address without UB in the first place because the pointer
> arithmetic is undefined.
But P1839 solves that problem. And this post was written under the
rules governed by P1839.
STD-PROPOSALS list run by herb.sutter at gmail.com
Standard Proposals Archives on Google Groups