Il 10/11/20 20:00, Giuseppe D'Angelo via Development ha scritto:
Yes, sure. But also something like QStringView, which is (char16_t*, qsizetype), is a primitive type (assuming all-0 representation for a null pointer).
Just to insist on this: there are no guarantees coming from the Standard that null pointers are all 0 bits. The only guarantees, if any, come from our platforms / platforms' ABI.
For instance , on the Itanium ABI:
* struct A { int a, b; }; can be value-initialized with 0 bits
* struct B { int *ptr; }; can be value-initialized with 0 bits
* struct C { int A::* ptr; }; *CANNOT BE VALUE-INITIALIZED* with 0 bits.
Because null pointers to data members are initialized with the value
"-1". https://gcc.godbolt.org/z/3aWWYx
So, one has to be extremely careful with marking something as primitive, and I don't think we have any tests regarding this (but we don't run on any platform with "fancy" null pointers either, I guess).
Thanks, -- Giuseppe D'Angelo | [email protected] | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: Firma crittografica S/MIME
_______________________________________________ Development mailing list [email protected] https://lists.qt-project.org/listinfo/development
