Advertisement
PVS-StudioWarnings

PVS-Studio warning V612 for Geant4

Nov 25th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. void G4QMDGroundStateNucleus::packNucleons()
  2. {
  3.   ....
  4.   while ( nmTry < maxTrial )
  5.   {
  6.     nmTry++;
  7.     G4int i = 0;
  8.     for ( i = 1 ; i < GetMassNumber() ; i++ )
  9.     {
  10.       ....
  11.     }
  12.     if ( i == GetMassNumber() )
  13.     {
  14.       areTheseMsOK = true;
  15.     }
  16.     break;
  17.   }
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V612 An unconditional 'break' within a loop. g4qmdgroundstatenucleus.cc 274
  24.  
  25. 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