$ more sep11b.cc
void g( int n);
void f( int n) { if (n & (0xff << 28)) g( n); } $ ~/cppcheck/trunk/cppcheck --enable=all sep11b.cc Checking sep11b.cc... $ clang++ -c -O2 -Wall sep11b.cc sep11b.cc:6:16: warning: signed shift result (0xFF0000000) requires 37 bits to represent, but 'int' only has 32 bits [-Wshift-overflow] if (n & (0xff << 28)) ~~~~ ^ ~~ 1 warning generated. $
it doesn't sound bad. you can report it in our issue tracker so we don't forget this.
Log in to post a comment.
$ more sep11b.cc
void g( int n);
void f( int n)
{
if (n & (0xff << 28))
g( n);
}
$ ~/cppcheck/trunk/cppcheck --enable=all sep11b.cc
Checking sep11b.cc...
$ clang++ -c -O2 -Wall sep11b.cc
sep11b.cc:6:16: warning: signed shift result (0xFF0000000) requires 37 bits to
represent, but 'int' only has 32 bits [-Wshift-overflow]
if (n & (0xff << 28))
~~~~ ^ ~~
1 warning generated.
$
it doesn't sound bad. you can report it in our issue tracker so we don't forget this.