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

Olivier Goffart olivier at woboq.com
Sun Feb 8 21:13:31 CET 2015


On Sunday 08 February 2015 20:06:14 André Pönitz wrote:
> On Sun, Feb 08, 2015 at 02:28:03PM +0100, Marc Mutz wrote:
> > 3. nullptr - On top of the warning, which I wasn't aware about, I find the
> > 
> >    code easier to read. It's a mouthful, but it's what everyone will be
> >    using
> >    five years from now, so we might as well start it now.
> 
> The original discussion was about Q_NULLPTR. You talk about nullptr.
> 
> This doesn't make the discussion easier, especially if the difference
> between them makes a difference to people's willingness to use them.

"nullptr" keyword is only supported from MSVC 2010 and GCC 4.6

Alternatively, one would define "nullptr" as a macro for compilers not 
supporting it. (instead of Q_NULLPTR)
I personally don't think it is good to do that because users may also define 
it. 
But if this makes the difference with people willing to start using nullptr, I 
think we could do that.


Note: replacing all the use of 0 with nullptr is quite easy with clang-
modernize. I have already used it to add Q_DECL_OVERRIDE everywhere.
So it would not be so much work to be safe against the nullptr warning.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org




More information about the Development mailing list