Advertisement
PVS-StudioWarnings

PVS-Studio warning V560 for MongoDB

Nov 27th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. void doRemove( OldDataCleanup& cleanup ) {
  2.   int it = 0;
  3.   while ( true ) {
  4.     if ( it > 20 && it % 10 == 0 )
  5.     {
  6.       scoped_lock ll(_workLock);
  7.       if ( ! _active ) {
  8.         cleanup.doRemove();
  9.         return;
  10.       }
  11.     }
  12.     sleepmillis( 1000 );
  13.   }
  14. }
  15.  
  16. 'it' doesn't change.
  17.  
  18. This suspicious code was found in MongoDB project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V560 A part of conditional expression is always false: it > 20. d_migrate.cpp 565
  21.  
  22. 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
Advertisement