[Development] Undeprecating QString::null

Thiago Macieira thiago.macieira at intel.com
Wed Jan 17 18:18:05 CET 2018


On Tuesday, 16 January 2018 10:28:27 PST Uwe Rathmann wrote:
> On Tue, 16 Jan 2018 18:38:48 +0100, Kevin Kofler wrote:
> > So just use QString(), or define your own static instance of it if you
> > really want to microoptimize it that much.
> 
> No it is simply that the first version of Qwt was for Qt 1.2 ( before
> QString even existed ) and during a history of almost 20 years there are
> leftovers.

Nitpick: QString existed in Qt 1.2, it just wasn't the QString we know.

It was actually the predecessor to Qt 2's QCString, which in Qt 4 became 
Q3CString and was deprecated by QByteArray.

> I had missed the point, when the static instance had been replaced -
> that's why I was erroneously concerned about BC breaks.

There's still static data, but unlike the Qt 1 solution, it's not an instance 
of QString but just of the shared null data. Since Qt 5, it's also shared with 
QVector and QByteArray. That's why the constructor is just as efficient.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Development mailing list