Hi, În ziua de miercuri, 21 august 2019, la 13:53:02 EEST, Giuseppe D'Angelo via Development a scris: > Hi, > > On 21/08/2019 11:50, Bogdan Vatra via Development wrote: > > Personally I'm not going to waste my time learning 10 sting wrappers > > and > > > > classes just to make some pico optimizations like: > > > > QString ext = QLatin1String("exe"); // it's terribly wrong and people > > which > > are doing this mistake must be stoned to death! > > > > QString ext = QStringLiteral("exe"); // it's so good and it will save the > > planet from extinction! > > > > // But > > QString ext1 = QLatin1String("exe") + ext; // it's ok > > // and > > QString ext = QStringLiteral("exe") + ext; // it's a abomination! > > > > // Even more > > QHash<QString, QString> test; > > test[QLatin1String("key1")] = QLatin1String("some text %1").arg(1); // > > wrong test[QStringLiteral("key1")] = QStringLiteral("some text > > %1").arg(1); // wrong again > > test[QLatin1String("key1")] = QStringLiteral("some text %1").arg(1); // > > still wrong > > test[QLatin1String("key1")] = QStringLiteral("some text %1").arg(1); // > > victory !!! > > How many of these are "mistakes" detectable by tooling? Because if they > are, they're a very minor issue. >
Holy mother of sweet Jesus Christ, are you calling these "minor issues" ?!?! Are you insane ? :) I don't think there is any tooling smart enough to detect *ALL* the situations. In previous examples I used only QLatin1String and QStringLiteral let's not forget that there are many more: QString::fromXXXXX, QStringView, and probably more that I don't know about. THB I don't think tooling is the right answer here, I'm still dreaming to a single simple and nice string class and maybe *one* wrapper *if* is really needed. Cheers, BogDan. _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development