Date: Tue, 21 Jul 2020 12:37:08 -0400
On Tue, Jul 21, 2020 at 11:56 AM Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> 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_at_[hidden]> wrote:
>
> 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.
Received on 2020-07-21 11:40:30