[Development] qsizetype and classes working with QStrings or QList

André Pönitz apoenitz at t-online.de
Tue Aug 25 21:05:24 CEST 2020


On Mon, Aug 24, 2020 at 09:26:54AM +0200, Giuseppe D'Angelo via Development wrote:
> On 23/08/2020 16:06, Marcel Krems wrote:
> > If they keep using int there could be a lot of warnings like this one:
> > warning: implicit conversion loses integer precision: 'qsizetype' (aka
> > 'long long') to 'int' [-Wshorten-64-to-32]
> 
> I'm afraid that these warnings will be all over the place anyhow. Just how
> much code has been written against int-based APIs?

Depends on the nature of the application, but in a typical Qt application
where GUI plays a major role, I would expect 'int' all over the place,

As an example, Qt Creator code has 48715 hits for '\bint\b', 1191 '\bsize_t',
most of the latter in 3rd party or test code.

> why I wanted a configure time switch to choose the size of qsizetype).

This doesn't really help if Qt comes with your distribution or even with
the Qt installers.

> But anyhow: yes, as a consistency factor, as many APIs as possible should be
> ported to qsizetype.

For us it was consistent so far. It is getting a pain only now. 

Andre'


More information about the Development mailing list