On Sun, Apr 12, 2009 at 01:04:36PM +0200, Vincent van Ravesteijn wrote: > If you are at it, could you then also explain when we should use > QLatin1String.
When one wants to avoid implicit conversations (preferably accompanied with #defined QT_NO_CAST_{FROM,TO}_ASCII - all of Qt itself uses that for instance). It also saves one typically not-inlined function call (but I've never seen a performance impact from _that_). > A few lines above, there is the line QString rc = > QLatin1String("background:") ? Does this have an added value or should > we just use QString rc("background:") ? The downside is that it is ugly as hell. Being able to use QT_NO_CAST_{FROM,TO}_ASCII it pretty helpful to prevent "accidental" and hard-to-track-down QString <-> QByteArray conversions, but unfortunately it requires all literals to be "decorated" by QLatin1String) Andre'