C++ Logo

std-proposals

Advanced search

Re: P1839 and the object representation of subobjects

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 21 Jul 2020 22:26:43 +0300
On Tue, 21 Jul 2020 at 22:23, Ville Voutilainen
<ville.voutilainen_at_[hidden]> wrote:
>
> On Tue, 21 Jul 2020 at 22:19, Thiago Macieira via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > On Tuesday, 21 July 2020 09:37:08 PDT Jason McKesson via Std-Proposals wrote:
> > > > 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.
> >
> > That was not the consensus of the discussions so far.
> >
> > P1839 may need a stronger wording to make it explicit that pointer arithmetic
> > on the char-sized backing buffer is well-defined.
>
> I have no idea how
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1839r2.pdf
> can be any *more* explicit about that. It says that both in the design
> part of the paper and in the wording.

..and it also explicitly allows going back to an object pointer from
an object representation pointer,
via a reinterpret_cast. It explicitly makes well-defined all the
things that we're worried about
in the context of QProperty.

Received on 2020-07-21 14:31:51