[Development] qsizetype

Thiago Macieira thiago.macieira at intel.com
Sat Mar 11 21:54:23 CET 2023

On Saturday, 11 March 2023 00:48:10 PST A. Pönitz wrote:
> Unfortunately for myself (and I am ready to take some blame for this
> ignorance) there was this parallel, and for me on first sight unrelated,
> development of the Q*View zoo, that started to set sizeof(qsizeype) ==
> sizeof(std::size_t) in stone and which currently seems to be the main
> obstacle to have a configurable sizeof(qsizetype). It is surely possible
> (and in my view sensible) to have sizeof(Q*View::size_type) ==
> sizeof(std::size_t) *while keeping* qize_type == int), but I wouldn't bet
> on this kind of outcome.

Not just size_t, and I don't think it's even the most important match. A lot 
of code in Qt 6 has begun assuming that sizeof(qsizetype) == sizeof(void *). 
That is, they are using qsizetype interchangeable with quintptr and qintptr. 
The view classes you're referring to above are not the only example; they may 
be the most visible one and thus the most correctable if we wanted to change, 
but it's very likely that there are many more hidden such uses inside the code 
that would just corrupt pointers left and right.

This is why I replied to Matthias that changing this is going to be more work 
than keep going now.

Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230311/0957f419/attachment.bin>

More information about the Development mailing list