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

Lubos Lunak l.lunak at suse.cz
Thu Mar 15 04:32:30 PDT 2012


On Thursday 15 of March 2012, James K. Lowden wrote:
> No, I can't agree.  The purpose of a warning is to indicate when a
> particular operation or construction might be unsafe.  A warning about
> something that cannot possibly be an error (as far as the machine is
> concerned) is just noise.

Clang has a lot of noise then. Just one random example:

$clang++ a.cpp 
a.cpp:6:16: warning: '&&' within '||' [-Wlogical-op-parentheses]
    if( a == 1 && b == 2 || c == 3 )
        ~~~~~~~^~~~~~~~~ ~~
a.cpp:6:16: note: place parentheses around the '&&' expression to silence this 
warning
    if( a == 1 && b == 2 || c == 3 )
               ^
        (               )
1 warning generated.

> As the standard doesn't define NULL

I think it actually does, to a certain extent, but just turn the warning off 
if you like to be special.

-- 
 Lubos Lunak
 l.lunak at suse.cz



More information about the cfe-dev mailing list