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

Matthew Woehlke mw_triad at users.sourceforge.net
Wed Feb 11 18:02:53 CET 2015


On 2015-02-11 04:18, Marc Mutz wrote:
> 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 :)

Will someone *please* explain to me why you think I'm not?

Marc: what made me scratch my head was your comments regarding 'emit'.
In general, you appear to be arguing for nullptr, but then you say you
don't like 'emit' while indicating that the arguments in favor of 'emit'
are similar to the arguments in favor of nullptr. Am I missing why this
isn't a contradiction? Is my irony detector broken?

>> (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.

(Ahem: "[this is] not relevant to Qt". Speaking of irony, I guess I'm
not the only one that can't keep the entire thread straight...)

> nor can it be relied on that Q_NULLPTR doesn't convert to an 
> integral type.

True for a given build. However, there is a fair chance that some other
(C++11) build will break in case of such code, increasing the chances
that someone will notice any issues of this nature.

> 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.

This too :-).

-- 
Matthew




More information about the Development mailing list