Opened 12 years ago
Closed 12 years ago
#4859 closed Bugs (fixed)
boost/asio/detail/impl/socket_ops.ipp:122 produces "expression is always true" compile error on MS Visual Studio 2008
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost Release Branch | Severity: | Problem |
Keywords: | Cc: |
Description
In boost/asio/detail/impl/socket_ops.ipp from boost_1_45_0_beta1 built with Microsoft Visual C++ compiler 2008, the following error is produced:
boost/asio/detail/impl/socket_ops.ipp(122): error C4296: '>=' : expression is always true
This is associated with the following block of code:
// Try to complete the operation without blocking. socket_type new_socket = socket_ops::accept(s, addr, addrlen, ec); // Check if operation succeeded. if (new_socket >= 0) return new_socket;
socket_type is defined in socket_types.hpp, which on Windows is:
typedef SOCKET socket_type;
SOCKET is defined in winsock.h/winsock2.h as:
typedef UINT_PTR SOCKET;
It would seem that new_socket should be compared to invalid_socket (defined in socket_types.hpp, line 86), which is the same test performed elsewhere in this file. The patch attached will produce this change but I'd like confirmation that the problem and solution are valid.
Also in:
- branches/release/boost/asio/detail/impl/socket_ops.ipp @ 66173
- trunk/boost/asio/detail/impl/socket_ops.ipp @ 66611
Attachments (1)
Change History (3)
by , 12 years ago
Attachment: | check_against_invalid_socket.patch added |
---|
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [66620]) Merge from trunk. ........
........