Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for Newton Game Dynamics

Nov 20th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. typedef unsigned long long dgUnsigned64;
  2.  
  3. dgUnsigned64 m_mantissa[DG_GOOGOL_SIZE];
  4.  
  5. dgGoogol::dgGoogol(dgFloat64 value)
  6.   :m_sign(0)
  7.   ,m_exponent(0)
  8. {
  9.   ....
  10.   m_mantissa[0] = (dgInt64 (dgFloat64 (
  11.                     dgUnsigned64(1)<<62) * mantissa));
  12.  
  13.   // it looks like GCC have problems with this
  14.   dgAssert (m_mantissa[0] >= 0);
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in Newton Game Dynamics project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V547 Expression 'm_mantissa[0] >= 0' is always true. Unsigned type value is always >= 0. dggoogol.cpp 55
  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
Advertisement