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

Chris Lattner clattner at apple.com
Fri Aug 26 16:30:50 PDT 2011


On Aug 26, 2011, at 1:57 PM, Douglas Gregor wrote:

>> That seems equivalent to suggesting NULL instead of 0 in pointer contexts in C++98, really. If you do that, then the compiler knows what you mean & can help you check that what you mean is what you actually got. (by checking NULL is used always and only in pointer contexts)
> 
> Two big differences here:
> 
>   1) if (a = b) is very likely to be an error
>   2) GCC 4.3 introduced -Wparentheses with roughly the same semantics as Clang eventually implemented, so the convention was pre-established
> 

3) nullptr is not safe to insert into arbitrary header files, because headers can be shared with C  or C++'98 code.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110826/fa86109a/attachment.html>


More information about the cfe-dev mailing list