Advertisement
PVS-StudioWarnings

PVS-Studio warning V501 for TickerTape

Nov 27th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. void CBaseCamera::GetInput(....)
  2. {
  3.   ...
  4.   if( m_GamePad[iUserIndex].wButtons ||
  5.       m_GamePad[iUserIndex].sThumbLX ||
  6.       m_GamePad[iUserIndex].sThumbLX ||
  7.       m_GamePad[iUserIndex].sThumbRX ||
  8.       m_GamePad[iUserIndex].sThumbRY ||
  9.       m_GamePad[iUserIndex].bLeftTrigger ||
  10.       m_GamePad[iUserIndex].bRightTrigger )
  11.   {
  12.     m_GamePadLastActive[iUserIndex] = DXUTGetTime();
  13.   }
  14.   ...
  15. }
  16.  
  17. This is what should have been written here: m_GamePad[iUserIndex].sThumbLX || m_GamePad[iUserIndex].sThumbLY ||.
  18.  
  19. This suspicious code was found in TickerTape project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V501 There are identical sub-expressions 'm_GamePad [iUserIndex].sThumbLX' to the left and to the right of the '||' operator. TickerTape dxutcamera.cpp 479
  22.  
  23. 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