[Development] QProperty and library coding guide

Thiago Macieira thiago.macieira at intel.com
Sat Jul 18 19:13:54 CEST 2020


On Saturday, 18 July 2020 07:11:51 PDT Giuseppe D'Angelo via Development 
wrote:
> > auto prop = object->propertyName;
> > return prop.value();
> 
> How? Just like QStringBuilder, there's no way to block a `const auto &`,
> is there?

A reference is ok. The problem is the copy or move, since now the object's 
this no longer points to the dummy member inside the QObject-derived class, 
but to somewhere on the stack. Then that UB pointer manipulation begins 
reading garbage and making matters go from bad to worse.

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





More information about the Development mailing list