[Development] Another integer typedef OR how to prepare for 64-bit in Qt 5

Jedrzej Nowacki Jedrzej.Nowacki at qt.io
Fri Nov 2 14:50:50 CET 2018


On Friday, November 2, 2018 4:42:52 AM CET Thiago Macieira wrote:
> We have a lot of API that, for Qt 6, we've already decided to extend to
> 64-bit on 64-bit platforms, but keep as decently-sized 32-bit on 32-bit
> ones.

Smells like qreal, with all problems that it causes... We could reconsider 
costs of using 64bit everywhere, it would streamline debugging of edge cases.

>  (...)
> Option 4: create a central #if and use this new type, starting now
> Same as #3, but instead of per class, it would be central. Moreover, with
> one preprocessor trick (-Dnewinttype=int), we can fool qdoc into generating
> documentation as it is today. In Qt 6, once we decide we don't need Qt 5
> merging anymore, we can also do a global search-and-replace to qsizetype
> (optional).

If I have to I would also pick option 4, but:
1. qsizetype can _not_ be a built in metatype in Qt5 (at best an alias).
2.  qsizetype needs to have QDataStream operators so it doesn't fallback to a 
platform dependent size
3. QDataStream stream autotests of class that uses the type would need to be 
extended.
4. I bet there is more, issues to solve, caused by pointer arithmetic ...

I would not try to trick qdoc to not see it. The consequences of size changing 
"randomly" are far too important, to be hidden.

Cheers,
  Jędrek




More information about the Development mailing list