PVS-StudioWarnings

PVS-Studio warning V501 for Geant4

Nov 19th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. void G4Penelope08RayleighModel::InitializeSamplingAlgorithm(
  2.   const G4Material* mat)
  3. {
  4.   ....
  5.   std::vector<size_t> *ITTL = new std::vector<size_t>;
  6.   std::vector<size_t> *ITTU = new std::vector<size_t>;
  7.   ....
  8.   if (ITTU->size() != np || ITTU->size() != np)
  9.     {
  10.       G4cout << "....." << G4endl;
  11.       G4cout << "....." << G4endl;
  12.       G4Exception();
  13.     }
  14.   ....
  15. }
  16.  
  17. Most likely this is what should be written here: ITTL->size() != np || ITTU->size() != np
  18.  
  19. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V501 There are identical sub-expressions to the left and to the right of the '||' operator: ITTU->size() != np || ITTU->size() != np G4emlowenergy g4penelope08rayleighmodel.cc 973
  22.  
  23. 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