[Development] QProperty and library coding guide

Thiago Macieira thiago.macieira at intel.com
Mon Jul 20 16:32:41 CEST 2020


On Monday, 20 July 2020 01:23:39 PDT Lars Knoll wrote: 
> But I don’t see why we would need to do this now, if the code we have works
> fine on current compilers. It’s all non inline, so we could add those kind
> of workarounds only if they become a requirement for a certain compiler. 

It's "inline" in the sense that it's generated by moc and therefore ends up in 
user code. That severely limits our ability to react, since users may (for 
their own reasons) want to restrict to a specific Qt version.

I am not going to accept a null-pointer dereference in there. The 
static_cast<T *>(nullptr)-> must go.

> > 
> > But see Ville's email. I think the pointer arithmetic is actually fine.
> > Would be fine too with uchar*.
> 
> What we’re doing is basically the reverse operation of:
> 
> T* o = ...;
> U *m = &o->m;
> 
> We need to go from the pointer to m back to the pointer of the surrounding
> object. While one way it perfectly defined by C++, there is unfortunately
> no way to reverse the operation in the standard. 

Time to write a paper for the C++ committee.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Development mailing list