Hello!

In zmq.hpp we have three destructors, two of them (namely  ~socket_t () and 
~message_t)
throw errors. This practice considered (and really is) bad.

In reality these destructors never throw.

I suggest we should get rid of throw in ~socket_t because zmq_close return 
error only
if socket is zero. It is unreal condition because ptr is private (1) result of 
zmq_socket
is checked in socket_t constructor (2).

I suggest we should get rid of throw in ~message_t because zmq_msg_close 
never return error.

--- /usr/include/zmq.hpp        2010-08-26 15:33:16.000000000 +0400
+++ /home/ilya_golshtein/tmp/zmq.hpp    2010-09-20 16:23:50.000000000 +0400
@@ -94,8 +94,7 @@
         inline ~message_t ()
         {
             int rc = zmq_msg_close (this);
-            if (rc != 0)
-                throw error_t ();
+            assert (rc == 0);
         }
 
         inline void rebuild ()
@@ -202,8 +201,7 @@
         inline ~socket_t ()
         {
             int rc = zmq_close (ptr);
-            if (rc != 0)
-                throw error_t ();
+            assert (rc == 0)
         }
 
         inline operator void* ()


-- 
Best regards,
Ilja Golshtein.
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to