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

André Pönitz apoenitz at t-online.de
Sun Feb 8 22:42:32 CET 2015


On Sun, Feb 08, 2015 at 10:17:40PM +0100, Allan Sandfeld Jensen wrote:
> What would be the point of macros if they always expanded? The entire point 
> and usefulness of these macros is that they expand to standard keywords when 
> those standard keywords exists.

What's the point of using a macro in circumstances where a portable, standard
conforming, safe-to-use, shorter-to-type, version _without_ using a macro
exists?

I.e. in case of a simple pointer initialization, why should one *ever* prefer 

void something()
{
    Foo *f = Q_NULLPTR;
    ...
}

over

void something()
{
    Foo *f = 0;
    ...
}

?

For the sake of keeping this part of the discussion simple, I specifically
mean 'Q_NULLPTR, the macro', _not_ 'nullptr', and I specifically mean the
context of initializing a local pointer variable. So: Any advantage? Any
advantage outweighing the disadvantages? 

Andre'



More information about the Development mailing list