Advertisement
PVS-StudioWarnings

PVS-Studio warning V517 for Geant4

Nov 25th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. G4double
  2. G4PropagatorInField::ComputeStep(
  3.                 G4FieldTrack&      pFieldTrack,
  4.                 G4double           CurrentProposedStepLength,
  5.                 G4double&          currentSafety, // IN/OUT
  6.                 G4VPhysicalVolume* pPhysVol)
  7. {
  8.   ....
  9.   if( stepTrial > 100.0*fZeroStepThreshold )
  10.     decreaseFactor = 0.35;     // Try decreasing slower
  11.   else if( stepTrial > 100.0*fZeroStepThreshold )
  12.     decreaseFactor= 0.5;       // Try yet slower decreases
  13.   else if( stepTrial > 10.0*fZeroStepThreshold )
  14.     decreaseFactor= 0.75;      // Try even slower decreases
  15.   else
  16.     decreaseFactor= 0.9;       // Try very slow decreases
  17.   ....
  18. }
  19.  
  20. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 227, 229. G4navigation g4propagatorinfield.cc 227
  23.  
  24. 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