[Development] QProperty and library coding guide
Ville Voutilainen
ville.voutilainen at gmail.com
Mon Jul 20 19:26:34 CEST 2020
On Mon, 20 Jul 2020 at 19:09, Thiago Macieira <thiago.macieira at intel.com> wrote:
>
> On Monday, 20 July 2020 08:40:06 PDT Oswald Buddenhagen wrote:
> > On Mon, Jul 20, 2020 at 07:32:41AM -0700, Thiago Macieira wrote:
> > >I am not going to accept a null-pointer dereference in there. The
> > >static_cast<T *>(nullptr)-> must go.
> >
> > this this construct is actually UB is disputed on wikipedia (in the
> > offsetof article).
>
> There's no dispute. It's a null-pointer dereference, so it's UB.
The member-access will not become valid. The only minor dispute is in
http://open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#232
but that will not make indirecting through a null pointer like that valid.
The only dispute in the offsetof article is about whether that
indirection is UB in C. In C++ it is, and will remain so.
That's why C++-compliant stddef.h implementations don't do that.
More information about the Development
mailing list