[Development] qsizetype and classes working with QStrings or QList
Christian Kandeler
christian.kandeler at qt.io
Mon Aug 24 14:34:44 CEST 2020
On Mon, 24 Aug 2020 14:45:19 +0300
Ville Voutilainen <ville.voutilainen at gmail.com> wrote:
> On Mon, 24 Aug 2020 at 12:17, Mathias Hasselmann
> <mathias at taschenorakel.de> wrote:
> > >> 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?
>
> I don't have verifiable evidence examples, but the gist of it is this:
>
> ConcreteType x = foo(); // this detects API breaks right here, right now
> ...
> ...
> ...
> some_use_of(x);
>
> With AAA, this might become
>
> auto x = foo(); // this always compiles
> ...
> ...
> ...
> some_use_of(x); // you may detect an API break here, or somewhere deep
> inside some_use_of
>
> I wonder where the verifiable evidence is that AAA works at scale.
What about:
some_use_of(foo());
Are you suggesting that this is an anti-pattern?
Christian
More information about the Development
mailing list