[cfe-commits] null pointer literals, warnings, and fixups

Douglas Gregor dgregor at apple.com
Mon Aug 29 17:46:32 PDT 2011

On Aug 21, 2011, at 9:18 PM, David Blaikie wrote:

> As a small indirect first attempt I've included a patch that:
> 1) changes "NULL" to "null" in "initialization of pointer of type %0
> to NULL from a constant boolean expression" - since NULL is a specific
> macro but the general concept is simply a "null pointer".

Looks good.

> 2) adds a fixup for this warning in C++0x to suggest using nullptr
> I think there's still a bunch of things worth discussing about when to
> suggest nullptr and what to suggest in C++98 (0, NULL, nothing at
> all?) & I'd like to apply this kind of suggestion/fixup in a much more
> general way (to all null pointer literals that aren't nullptr, not
> just the false boolean literal) - but I thought this might be a
> moderately easy experiment, even if it's throwaway, and might be a
> more concrete thing to start such discussions.

Seems like we should suggest nullptr, NULL, or 0, depending on which dialect we're in, as we've done elsewhere.

	- Doug

More information about the cfe-commits mailing list