Advertisement
PVS-StudioWarnings

PVS-Studio warning V612 for OpenDDS

Nov 24th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. void Socket_Impl::
  2.   send_ (void const* buf, size_t s)
  3. {
  4.   ....
  5.   while (queue_.is_empty ())
  6.   {
  7.     if (timeout)
  8.     {
  9.       if (cond_.wait (&abs_time) != -1)
  10.         break;
  11.     }
  12.     else
  13.     {
  14.       if (cond_.wait () != -1)
  15.         break;
  16.     }
  17.  
  18.     return -1; // errno is already set
  19.   }
  20.   ....
  21. }
  22.  
  23. This suspicious code was found in OpenDDS project by PVS-Studio static code analyzer.
  24. Warning message is:
  25. V612 An unconditional 'return' within a loop. socket.cpp 187
  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