[Development] Hardcoded strings and qstricmp comparison

Thiago Macieira thiago.macieira at intel.com
Wed Nov 14 17:29:25 CET 2018


On Wednesday, 14 November 2018 00:34:50 PST Andy Shaw wrote:
> For user code I get that we can just say that they should do something like:
> 
>   qstricmp(str, QLatin1String("a").latin1());

What we should do is actually have QLatin1String overloads of the functions in 
questions. We already have quite a few in qstringalgorithms.h, including this 
pearl of wisdom:

Q_REQUIRED_RESULT               bool isLatin1(QLatin1String s) Q_DECL_NOTHROW; 
// in qstring.h

The thing is, those older functions like qstricmp are meant to be used with 
QByteArray, which is documented to operate on Latin1 (see isUpper and 
toUpper).
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Development mailing list