[Interest] (no subject)

Thiago Macieira thiago.macieira at intel.com
Mon Jun 29 17:40:59 CEST 2015


On Monday 29 June 2015 16:09:55 Prav wrote:
> > When should you use QStringLiteral, QString::fromLatin1 or QLatin1String?
> 
> Same happenes with this selection also. No clear description in the
> documentation.
> 
> 
> I do not see problem with selecting best option as soon as this options are
> clearly described in documentation. And where is not so many things which
> is unclear for selection ... so not a problem to understand thma all. Or I
> am wrong?

Yes.

The problem is not in understanding what the function does. All three do 
roughly the same thing.

The problem is that to choose the best option, you have to understand *how* 
they do what they do, which implies knowing the implementation details. You 
will need to read the source code for the function/class/macro.

> > Because providing subtly different options confuses when it is right to
> > use each one.> 
> And const-ref loop seems to be the best for Qt and std containers.
> So recomendation can be to use "forevery" everythere (with Qt containers or
> std containers ... does no matter) except you have some special cases with
> signal-slots calls (which I never saw) I think it is quite a clear choice.

First of all, "forevery" is too close to "foever", so we'd need another name.

Second, you're arguing that it's best for everyone, so why can't we change 
foreach?

And third, if for Qt containers the benefit is less than 1 microsecond, why 
should we add it? I recommend adding it to a library that makes more use of 
the Standard Library instead.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list