Skip to content

Commit

Permalink
Prevent unused variable warning in presence of assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamet committed Feb 14, 2012
1 parent 73f167e commit 1bff796
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions include/zmq.hpp
Expand Up @@ -40,6 +40,14 @@
# define ZMQ_HAS_RVALUE_REFS
#endif

// In order to prevent unused variable warnings when building in non-debug
// mode use this macro to make assertions.
#ifndef NDEBUG
# define ZMQ_ASSERT(expression) assert(expression)
#else
# define ZMQ_ASSERT(expression) (expression)
#endif

namespace zmq
{

Expand Down Expand Up @@ -118,7 +126,7 @@ namespace zmq
inline ~message_t ()
{
int rc = zmq_msg_close (this);
assert (rc == 0);
ZMQ_ASSERT (rc == 0);
}

inline void rebuild ()
Expand Down Expand Up @@ -214,7 +222,7 @@ namespace zmq
if (ptr == NULL)
return;
int rc = zmq_term (ptr);
assert (rc == 0);
ZMQ_ASSERT (rc == 0);
}

// Be careful with this, it's probably only useful for
Expand Down

0 comments on commit 1bff796

Please sign in to comment.