PVS-StudioWarnings

PVS-Studio warning V520 for GLG3D

Nov 21st, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. void AnyVal::serialize(G3D::TextOutput& t) const {
  2.   ...
  3.   const Matrix3& m = *(Matrix3*)m_value;
  4.   ...
  5.   t.printf("%10.5f, %10.5f, %10.5f,\n"
  6.            "%10.5f, %10.5f, %10.5f,\n"
  7.            "%10.5f, %10.5f, %10.5f)",
  8.            m[0, 0], m[0, 1], m[0, 2],
  9.            m[1, 0], m[1, 1], m[1, 2],
  10.            m[2, 0], m[2, 1], m[2, 2]);
  11.   ...
  12. }
  13.  
  14. This is what should have been written here: ...., m[0][0], m[0][1], ....
  15.  
  16. This suspicious code was found in GLG3D project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V520 The comma operator ',' in array index expression '[0, 0]'. graphics3D anyval.cpp 275
  19.  
  20. 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