[Development] RFF: nullptr rules

Marc Mutz marc.mutz at kdab.com
Wed Dec 9 19:39:28 CET 2015

On Wednesday 09 December 2015 16:19:38 Matthew Woehlke wrote:
> > - APIs that require the use of nullptr for disambiguation are
> > discouraged,
> >
> >   but may be acceptable to be decided on a case-by-case basis.
> On that note, there is one case in which '0' as nullptr makes sense...
> default values for QFlags. A literal '0' "looks like" an empty bitset
> much more than 'nullptr', even though IIRC it actually ends up
> implemented via a void* ctor. This probably means that those should be
> changed to use '{}' as the default initializer instead (i.e. not
> 'nullptr'). I'm not sure what this means for compiler support (i.e. if
> any compilers that Qt still supports don't support it), though I do know
> offhand it does exclude GCC < 4.7.
> (Alternatively, there could be a qNullFlag or some such, but that might
> have compatibility problems.)

FTR: this is already fixed in QtBase 5.6, but not other modules, by using the 
default ctor (uniform init isn't required in Qt 5.7).

Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts

More information about the Development mailing list