[cfe-dev] [PATCH] -Wconversion-null

Lubos Lunak l.lunak at suse.cz
Thu Mar 15 01:21:31 PDT 2012


On Thursday 15 of March 2012, James K. Lowden wrote:
> On Tue, 13 Mar 2012 23:04:35 +0100
>
> Lubos Lunak <l.lunak at suse.cz> wrote:
> >  the attached patch adds option -Wconversion-null . It is pretty much
> > the same like http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35669 .
>
> Am I missing the point entirely?  If I do this:
>
> #undef NULL
> #define NULL 0
>
> The code you presented is valid C++ and the proposed warnings are all
> misplaced.

 It is valid C++, but that is why it is a warning and not an error. All 
warnings are about code which is technically valid, yet is (more or less) 
likely a mistake.

> If NULL is defined as 
>
> 	(void*)0;
>
> or somesuch, warnings should occur anyway on architectures that have
> bigger pointers than ints.

 This, on the other hand, is invalid C++.

-- 
 Lubos Lunak
 l.lunak at suse.cz



More information about the cfe-dev mailing list