[Interest] Building strings with .arg() (arrrgh)

Max Paperno max-l at wdg.us
Thu Mar 5 21:23:41 CET 2020


On 3/5/2020 3:11 PM, Elvis Stansvik wrote:
> Den tors 5 mars 2020 kl 19:26 skrev Max Paperno <max-l at wdg.us>:
>> One thing for sure, since my benchmarks, from here on I will very much
>> prefer the "multiArg" version of .arg() vs. using multiple .arg()s.
> 
> Closing side note: There's a a nice Clazy diagnostic for that.

Indeed, but IIRC it only warns when using multiple strings, like 
.arg("string").arg("other"), not with, for example 
.arg("string").arg(5). Whereas it's still considerably faster (and I 
presume more "efficient") to do .arg("string", QString::fromNumber(5)). 
Even just a single .arg(QString::fromNumber(5)) seems a little faster 
than .arg(5).

Best,
-Max


More information about the Interest mailing list