Advertisement
PVS-StudioWarnings

PVS-Studio warning V801 for Crystalspace

Nov 27th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. static void TriSwap (csTriangle*& tr, const csTriangle tri,
  2.                      bool in)
  3. {
  4.   if (in)
  5.   {
  6.     tr->a = tri.c;
  7.     tr->b = tri.b;
  8.     tr->c = tri.a;
  9.   }
  10.   else
  11.   {
  12.     tr->a = tri.a;
  13.     tr->b = tri.b;
  14.     tr->c = tri.c;
  15.   }
  16.   tr++;
  17. }
  18.  
  19. a, b, c - int.
  20.  
  21. csTriangle is a class that has a copying constructor.
  22.  
  23. This suspicious code was found in Crystalspace project by PVS-Studio static code analyzer.
  24. Warning message is:
  25. V801 Decreased performance. It is better to redefine the second function argument as a reference. Consider replacing 'const .. tri' with 'const .. &tri'. libcrystalspace primitives.cpp 50
  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
Advertisement