PVS-StudioWarnings

PVS-Studio warning V547 for Source SDK

Nov 19th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. unsigned  numbounce = 100;
  2.  
  3. int ParseCommandLine( int argc, char **argv, bool *onlydetail )
  4. {
  5.   ....
  6.   numbounce = atoi (argv[i]);
  7.   if ( numbounce < 0 )
  8.   {
  9.     Warning(
  10.       "Error: expected non-negative value after '-bounce'\n");
  11.     return 1;
  12.   }
  13.   ....
  14. }
  15.  
  16. This suspicious code was found in Source SDK project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V547 Expression 'numbounce < 0' is always false. Unsigned type value is never < 0. Vrad_dll vrad.cpp 2412
  19.  
  20. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment