PVS-StudioWarnings

PVS-Studio warning V547 for tracetool

Nov 13th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. static UINT_PTR m_socketHandle ;
  2.  
  3. void TTrace::LoopMessages(void)
  4. {
  5.   ...
  6.   // Socket creation
  7.   if ( (m_socketHandle = socket(AF_INET,SOCK_STREAM,0)) < 0)
  8.   {
  9.     continue;
  10.   }
  11.   ...
  12. }
  13.  
  14. This suspicious code was found in tracetool project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V547 Expression '(m_socketHandle = socket (2, 1, 0)) < 0' is always false. Unsigned type value is never < 0. Vs8_Win_Lib tracetool.cpp 871
  17.  
  18. 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