[Development] Upgrading the sources to C++11 keywords (Q_NULLPTR, etc.)

Marc Mutz marc.mutz at kdab.com
Wed Feb 11 10:18:22 CET 2015

On Wednesday 11 February 2015 00:37:18 Matthew Woehlke wrote:
> Marc, I'm not sure if you're arguing for or against nullptr :-)...

Then I agree with André; you need to start reading mails (threads) before 
responding :)

> On 2015-02-10 18:23, Marc Mutz wrote:
> > On Tuesday 10 February 2015 20:13:12 André Pönitz wrote:
> >> Can't you simply wait until 'nullptr' is available?
> > 
> > No.
> > 
> > For a simple reason: using nullptr (Q_ or not) is more expressive than 0.
> > And why would i want to throw away information I already have?
> (Oh... and 'auto ptr = 0;' does not give you a pointer. Not relevant to
> Qt, but just saying...)

While true, this is semantics that we can't rely on in Qt atm. Neither can 
auto be used, nor can it be relied on that Q_NULLPTR doesn't convert to an 
integral type. The latter is esp. interesting, as I believe some compilers 
implement NULL to be nullptr-like even in C++98 (and Q_NULLPTR is NULL if it's 
not nullptr), so you *may* benefit even in C++98 by using Q_NULLPTR instead of 
0. But you can't _rely_ on that.


Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions

More information about the Development mailing list