[Interest] Can QObject::tr() be used in initialization of static const QString data members? [Qt 5.5.1, Windows]
Thiago Macieira
thiago.macieira at intel.com
Tue Nov 10 19:00:23 CET 2015
On Tuesday 10 November 2015 11:31:57 Matthew Woehlke wrote:
> On 2015-11-09 17:35, Thiago Macieira wrote:
> > I advise against static QStrings altogether. Just don't do that.
>
> What's the problem with static QString?
There's no actual error or problem, but it's just poor coding practice.
It's a static non-trivial type. We avoid those in Qt, so I make the
recommendation to everyone, everywhere.
Static non-trivials imply a load-time and exit-time overhead, even if you
never use that variable again. Better to initialise on first use and make sure
you really need to cache the result.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list