[Development] QStringLiteral vs QLatin1String , foreach vs for range
thiago.macieira at intel.com
Sun Jan 17 20:36:41 CET 2016
On Sunday 17 January 2016 19:13:44 Gunnar Roth wrote:
> I saw quite some changes like https://codereview.qt-project.org/#/c/145961/
> <https://codereview.qt-project.org/#/c/145961/> Replace QStringLiteral
> with QLatin1String in QFileSelector. I also read about the problem of
> QStringLiteral concerning plugins, but what is the idea behind these
> changes ?
QLatin1String is more efficient if you're calling a method that has a
QLatin1String overload, like most methods in QString itself.
As for the plugin problem, it's what happens when you refer to global
variables in plugins that get unloded.
> There is also a lot of replacing foreach with range for loops? What is the
> idea behind this? Any links to read?
foreach copies; ranged for doesn't.
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development