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

Douglas Gregor dgregor at apple.com
Thu Aug 25 10:41:48 PDT 2011


On Aug 25, 2011, at 9:36 AM, David Blaikie wrote:

> I don't think these warnings would be suitable for Clang.
> 
> Even suggesting nullptr in C++11? With things like the bool warning, NULL* used in non-pointer contexts, etc already, this seems like a fairly logical continuation/generalization of that - or would you say that, even in C++11, that it's clear that false is probably not intended as a pointer literal but still likely that someone should use 0/NULL/etc rather than nullptr?

Just because someone is compiling with C++0x doesn't mean they want to automatically upgrade their code to C++0x.

> 
> Such style-checking transformations belong in a separate tool (e.g., like the ARC migrator).
> 
> I'll have to look into how the ARC migrator works - both for the migration & for keeping code style consistent in the long term. That's part of what I was getting at - I turn on the "use nullptr" warning & then I'm never going to accidentally end up with weird uses of NULL or 0/false/etc in my code (or even in llvm's code if there was a nice way to implement some C++98 equivalent), ideally.

I understand what you're getting at, but I consider it the domain of a separate style checker rather than something that should be implemented as a warning.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110825/50ced85d/attachment.html>


More information about the cfe-dev mailing list