mathieu wrote: > > I am looking for a flag that would warn me about someting like this > (*). I have tried so far: > > $ g++ -Wall -Wextra -Wconversion -Wsign-compare -g unsigned.cxx > > Thanks > -Mathieu > (*) > #include <iostream> > > unsigned int size() > { > return 0; > } > > int main(int, char*[]) > { > unsigned int s = size(); > unsigned int index = 1; > if ( index <= s - 1 )
//if (!s) condition "if( index <= (s - 1) )" is always true if(s) if ( index <= (s - 1) ) > { > std::cout << index << " is valid for size " << s << std::endl; > } > return 0; > } > _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus