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. Whether offsetof() uses that technique to provide a defined behaviour or not is irrelevant. offsetof() is a macro provided by the compiler, so the compiler maintainers know what code their compiler will generate. > anyway, this can be trivially bypassed by just using an arbitrary > address and subtracting the offset. or using offsetof, indeed. in any > case it's 3 minutes of work. ;) Someone please submit it then. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel DPG Cloud Engineering _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development