[Development] QMetaType::NeedsConstruction vs QTypeInfo<T>::isComplex

Fabian Kosmale fabian.kosmale at qt.io
Mon Mar 1 11:45:59 CET 2021


currently we promise that if for a type its QMetaType does not have the NeedsConstruction flag set, it can be initialized with memzero. We set that flag if the type is complex according to QTypeInfo. However, after the discussion in https://lists.qt-project.org/pipermail/development/2020-November/040546.html, primitive types are not complex, but only guarantee that they can be memcpyed not memzeroed. Therefore either the implementation or the documentation of NeedsConstruction needs  to change (note that Qt itself does not use that flag anywhere as far as I can tell).
But which of those two options should we choose? What are the actual use-cases of that flag anyway?

Fabian Kosmale
Software Engineer

The Qt Company GmbH
Erich-Thilo-Str. 10
D-12489 Berlin
fabian.kosmale at qt.io
+49 1638686070

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 144331 B


More information about the Development mailing list