[Development] QProperty and library coding guide
hausmann at gmail.com
Sat Jul 18 08:32:41 CEST 2020
Thiago Macieira <thiago.macieira at intel.com> schrieb am Fr. 17. Juli 2020 um
> On Wednesday, 15 July 2020 13:20:33 PDT Thiago Macieira wrote:
> > In addition, I'd like someone to explain here:
> 5) How you're going to fix the UB in the code generated by moc. This
> a satisfactory answer of C++17 or C++2a strictly compliant code, or we'll
> to stop using this feature.
> moc generates:
> Type Klass::_qt_property_api_propertyName::value() const
> const size_t propertyMemberOffset =
> const auto *thisPtr = reinterpret_cast<const Klass *>(
> reinterpret_cast<const char *>(this) - propertyMemberOffset);
> return thisPtr->d_func()->property.value();
> The first two lines of this function are UB.
> It MUST be fixed.
This hack has been in QtQml in production since its release in 2010 (see
static cast selector).
It would be a shame if this stopped working :-/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Development