[Development] qsizetype and classes working with QStrings or QList

Mathias Hasselmann mathias at taschenorakel.de
Mon Aug 24 11:17:24 CEST 2020


Am 24.08.2020 um 11:04 schrieb Ville Voutilainen:
> On Mon, 24 Aug 2020 at 10:50, Mathias Hasselmann
> <mathias at taschenorakel.de> wrote:
>> Am 24.08.2020 um 09:26 schrieb Giuseppe D'Angelo via Development:
>>
>> 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? (For the record, that's why I wanted a configure time switch to choose the size of qsizetype).
>>
>> But anyhow: yes, as a consistency factor, as many APIs as possible should be ported to qsizetype. Could you please file a bug report?
>>
>> C++ also has a solution for that problem:  https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/
> That non-solution is terrible. The very reason for not using deduced
> types is to detect API breaks loudly.
> The warning does that in dulcet tones, not as loudly as some might
> wish because the conversion is implicit.
> Buying the AAA snake oil can move the problem elsewhere for a while,
> but it's not helpful; it's partially
> hiding an API break, and it's unlikely that you want that to continue;
> the manifestations of the API break
> are going to appear further away from the spots where they could be
> first detected.

Do you have examples showing verifiable evidence, or do you share a feeling?

Ciao
Mathias



More information about the Development mailing list