Advertisement
PVS-StudioWarnings

PVS-Studio warning V501 for Geant4

Nov 26th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. G4double G4MesonAbsorption::
  2. GetTimeToAbsorption(const G4KineticTrack& trk1,
  3.                     const G4KineticTrack& trk2)
  4. {
  5.   ....
  6.   if(( trk1.GetDefinition() == G4Neutron::Neutron() ||
  7.        trk1.GetDefinition() == G4Neutron::Neutron() ) &&
  8.        sqrtS>1.91*GeV && pi*distance>maxChargedCrossSection)
  9.     return time;
  10.   ....
  11. }
  12.  
  13. Most likely this is what should be written here: trk1.GetDefinition() == G4Neutron::Neutron() || trk2.GetDefinition() == G4Neutron::Neutron()
  14.  
  15.  
  16. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V501 There are identical sub-expressions 'trk1.GetDefinition() == G4Neutron::Neutron()' to the left and to the right of the '||' operator. G4had_im_r_matrix g4mesonabsorption.cc 285
  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
Advertisement