PVS-StudioWarnings

PVS-Studio warning V535 for Lugaru

Nov 20th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. float Skeleton::DoConstraints(XYZ *coords,float *scale)
  2. {
  3.   ...
  4.   static int i,j,k,l,m;
  5.   ...
  6.   for(j=0; j<numrepeats; j++){
  7.     ...
  8.     for(i=0; i<num_joints; i++){
  9.       ...
  10.       for(j=0;j<num_joints;j++){
  11.         if(joints[j].locked)freely=0;
  12.       }
  13.       ...
  14.     }
  15.     ...
  16.   }
  17.   ...
  18. }
  19.  
  20. In general, there are a lot of fragments in Lugaru where one and the same variable is used both for inner and outer loops. But functions are huge and it's difficult to understand if there is really an error.
  21.  
  22.  
  23. This suspicious code was found in Lugaru project by PVS-Studio static code analyzer.
  24. Warning message is:
  25. V535 The variable 'j' is being used for this loop and for the outer loop. Lugaru skeleton.cpp 392
  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