From 4bc232c175859ce0d5773bc3d6749c8bb8a7eb1b Mon Sep 17 00:00:00 2001 From: Gudmundur Adalsteinsson Date: Sat, 26 Oct 2019 12:31:51 +0000 Subject: [PATCH] Problem: recv return value should not be ignored Solution: add nodiscard attribute to recv functions --- zmq.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zmq.hpp b/zmq.hpp index f4a3d70c..476b03cb 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -1348,7 +1348,7 @@ class socket_base } #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 @@ class socket_base 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(flags)); if (nbytes >= 0) {