PVS-StudioWarnings

PVS-Studio warning V596 for Geant4

Nov 18th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. inline G4double G4GeneralPhaseSpaceDecay::Pmx(
  2.    G4double e, G4double p1, G4double p2)
  3. {
  4.   // calculate momentum of daughter particles in two-body decay
  5.   if (e-p1-p2 < 0 )
  6.   {
  7.     G4HadronicException(__FILE__, __LINE__,
  8.       "G4GeneralPhaseSpaceDecay::Pmx energy in "
  9.       "cms > mass1+mass2");
  10.   }
  11.   ....
  12. }
  13.  
  14. Most likely this is what should be written here: throw G4HadronicException(__FILE__, __LINE__, ....);
  15.  
  16.  
  17. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V596 The object was created but it is not being used. The 'throw' keyword could be missing: throw G4HadronicException(FOO); G4had_mod_util g4generalphasespacedecay.hh 116
  20.  
  21. 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