PVS-StudioWarnings

PVS-Studio warning V547 for Geant4

Nov 12th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. G4bool G4CollisionMesonBaryonElastic::
  2.  IsInCharge(const G4KineticTrack& trk1,
  3.             const G4KineticTrack& trk2) const
  4.  {
  5.    G4bool result = false;
  6.    G4ParticleDefinition * p1 = trk1.GetDefinition();
  7.    G4ParticleDefinition * p2 = trk2.GetDefinition();
  8.    if(   (GetNumberOfPartons(p1) != 2 ||
  9.           GetNumberOfPartons(p2) != 3)
  10.        ||(GetNumberOfPartons(p1) != 3 ||
  11.           GetNumberOfPartons(p2) != 2) )
  12.    {
  13.      result = false;
  14.    }
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V547 Expression is always true. Probably the '&&' operator should be used here. G4had_im_r_matrix g4collisionmesonbaryonelastic.cc 53
  21.  
  22. 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