PVS-StudioWarnings

PVS-Studio warning V621 for Geant4

Nov 20th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. void G4QMDCollision::CalKinematicsOfBinaryCollisions(
  2.   G4double dt )
  3. {
  4.   ....
  5.   G4int id = 0;
  6.   ....
  7.   if ( secs )
  8.   {
  9.     ....
  10.     id++;
  11.     ....
  12.   }
  13.   if ( std::abs ( eini - efin ) < fepse*10 )
  14.     ....
  15.   else
  16.   {
  17.     ....
  18.     for ( G4int i0i = 0 ; i0i < id-1 ; i0i++ )
  19.     {
  20.       theSystem->DeleteParticipant( i0i+n0 );
  21.     }
  22.     ....
  23.   }
  24.   ....
  25. }
  26.  
  27. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  28. Warning message is:
  29. V621 Consider inspecting the 'for' operator. It's possible that the loop will be executed incorrectly or won't be executed at all. _G4processes-archive g4qmdcollision.cc 228
  30.  
  31. 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