PVS-StudioWarnings

PVS-Studio warning V517 for Geant4

Nov 17th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. void G4Polyhedra::Create( G4double phiStart,
  2.                           G4double phiTotal,
  3.                           G4int    theNumSide,
  4.                           G4ReduciblePolygon *rz  )
  5. {
  6.   ....
  7.   G4double rzArea = rz->Area();
  8.   if (rzArea < -kCarTolerance)
  9.     rz->ReverseOrder();
  10.  
  11.   else if (rzArea < -kCarTolerance)
  12.   {
  13.     G4cerr << "ERROR - G4Polyhedra::Create() "
  14.            << GetName() << G4endl
  15.            << "        R/Z cross section is zero or near zero: "
  16.            << rzArea << G4endl;
  17.     G4Exception("G4Polyhedra::Create()", "InvalidSetup",
  18.                 FatalException, "Illegal input parameters.");
  19.   }
  20.   ....
  21. }
  22.  
  23. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  24. Warning message is:
  25. V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 209, 212. G4specsolids g4polyhedra.cc 209
  26.  
  27. 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