Problem: recv return value should not be ignored

Solution: add nodiscard attribute to recv functions
This commit is contained in:
Gudmundur Adalsteinsson 2019-10-26 12:31:51 +00:00
parent fdb2f13971
commit 4bc232c175

View File

@ -1348,7 +1348,7 @@ public:
}
#ifdef ZMQ_CPP11
detail::recv_buffer_result_t recv(mutable_buffer buf,
ZMQ_NODISCARD detail::recv_buffer_result_t recv(mutable_buffer buf,
recv_flags flags = recv_flags::none)
{
const int nbytes =
@ -1362,7 +1362,7 @@ public:
throw error_t();
}
detail::recv_result_t recv(message_t &msg, recv_flags flags = recv_flags::none)
ZMQ_NODISCARD detail::recv_result_t recv(message_t &msg, recv_flags flags = recv_flags::none)
{
const int nbytes = zmq_msg_recv(msg.handle(), _handle, static_cast<int>(flags));
if (nbytes >= 0) {