I am using the following methods:
boost::asio::streambuf io_bufstream;
boost::asio::async_read_until(socket_, io_bufstream, "</message>",
strand_.wrap(
boost::bind(&Connection::handleRead, shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));//warning: line 36
boost::array<char, 8192> buffer_
socket_.async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
boost::bind(&Connection::handleRead, shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred))); // warning
I get the following warning:
C:\dev\sapphire\boost_1_46_1\boost/asio/detail/reactive_socket_recv_op.hpp(58) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
Here is the complete output as well:
C:\dev\sapphire\boost_1_46_1\boost/asio/detail/reactive_socket_recv_op.hpp(58) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
C:\dev\sapphire\boost_1_46_1\boost/asio/detail/reactive_socket_recv_op.hpp(48) : while compiling class template member function 'bool boost::asio::detail::reactive_socket_recv_op_base::do_perform(boost::asio::detail::reactor_op *)'
with
[
MutableBufferSequence=boost::asio::mutable_buffers_1
]
C:\dev\sapphire\boost_1_46_1\boost/asio/detail/reactive_socket_recv_op.hpp(71) : see reference to class template instantiation 'boost::asio::detail::reactive_socket_recv_op_base' being compiled
with
[
MutableBufferSequence=boost::asio::mutable_buffers_1
]
C:\dev\sapphire\boost_1_46_1\boost/asio/detail/reactive_socket_service_base.hpp(227) : see reference to class template instantiation 'boost::asio::detail::reactive_socket_recv_op' being compiled
with
[
MutableBufferSequence=boost::asio::mutable_buffers_1,
Handler=boost::asio::detail::wrapped_handler,boost::_bi::list3>,boost::arg<1>,boost::arg<2>>>>
]
C:\dev\sapphire\boost_1_46_1\boost/asio/stream_socket_service.hpp(263) : see reference to function template instantiation 'void boost::asio::detail::reactive_socket_service_base::async_receive(boost::asio::detail::reactive_socket_service_base::base_implementation_type &,const MutableBufferSequence &,boost::asio::socket_base::message_flags,Handler)' being compiled
with
[
MutableBufferSequence=boost::asio::mutable_buffers_1,
ReadHandler=boost::asio::detail::wrapped_handler,boost::_bi::list3>,boost::arg<1>,boost::arg<2>>>>,
Handler=boost::asio::detail::wrapped_handler,boost::_bi::list3>,boost::arg<1>,boost::arg<2>>>>
]
C:\dev\sapphire\boost_1_46_1\boost/asio/basic_stream_socket.hpp(708) : see reference to function template instantiation 'void boost::asio::stream_socket_service::async_receive(boost::asio::detail::reactive_socket_service::implementation_type &,const MutableBufferSequence &,boost::asio::socket_base::message_flags,ReadHandler)' being compiled
with
[
Protocol=boost::asio::ip::tcp,
MutableBufferSequence=boost::asio::mutable_buffers_1,
ReadHandler=boost::asio::detail::wrapped_handler,boost::_bi::list3>,boost::arg<1>,boost::arg<2>>>>
]
..\..\..\platform_epi\src\connection.cpp(36) : see reference to function template instantiation 'void boost::asio::basic_stream_socket::async_read_some>(const MutableBufferSequence &,ReadHandler)' being compiled
with
[
Protocol=boost::asio::ip::tcp,
Dispatcher=boost::asio::io_service::strand,
Handler=boost::_bi::bind_t,boost::_bi::list3>,boost::arg<1>,boost::arg<2>>>,
MutableBufferSequence=boost::asio::mutable_buffers_1,
ReadHandler=boost::asio::detail::wrapped_handler,boost::_bi::list3>,boost::arg<1>,boost::arg<2>>>>
]
From my understanding is that the error comes from line 36 but I don’t understand what is happening. I think it has something to do with the bytes_transferred being used as a bool when it is int. If anyone could clarify on this issue and/or how to fix it, it would be superb!
Thanks!
This is a Visual Studio-specific warning, and it’s being emitted from Boost’s code, not yours. It can be ignored in most cases. If you want to disable it, use the appropriate pragma.
It may have been fixed in the latest Boost.ASIO version. I have 1.47 installed and the line in question doesn’t emit this warning.