pfultz2/cppcheck

Opposite expressions on both sides of '!='

Closed this issue · 0 comments

void f(bool a)
{
   if( a == a ) {} // [t.cpp:3] -> [t.cpp:3]: (style) Same expression on both sides of '=='
   if( a == !(a) ) {} // false negative
   if( a == !(!a) ) {} // false negative
   if( a != a ) {} // [t.cpp:6] -> [t.cpp:6]: (style) Same expression on both sides of '!='.
   if( a != !(a) ) {} // false negative
   if( a != !(!a) ) {} // false negative
   if( !(a) == a ) {} // false negative
   if( !(a) == !(a) ) {} // [t.cpp:10] -> [t.cpp:10]: (style) Same expression on both sides of '=='.
   if( !(a) == !(!a) ) {} // false negative
   if( !(a) != a ) {} // false negative
   if( !(a) != !(a) ) {} // [t.cpp:13] -> [t.cpp:13]: (style) Same expression on both sides of '!='.
   if( !(a) != !(!a) ) {} // false negative
   if( !(!a) == a ) {} // false negative
   if( !(!a) == !(a) ) {} // false negative
   if( !(!a) == !(!a) ) {} // [t.cpp:17] -> [t.cpp:17]: (style) Same expression on both sides of '=='.
   if( !(!a) != a ) {} // false negative
   if( !(!a) != !(a) ) {} // false negative
   if( !(!a) != !(!a) ) {} // [t.cpp:20] -> [t.cpp:20]: (style) Same expression on both sides of '!='.
}