[zeromq-dev] zmq destructor throws?
Martin Sustrik
sustrik at 250bpm.com
Mon Jul 19 19:37:21 CEST 2010
Matt Weinstein wrote:
> Folks,
>
> While wandering through the zmq.hpp header to implement the nothrow
> version, I noticed that many of the destructors throw(), e.g.
>
>
> inline ~message_t ()
> {
> int rc = zmq_msg_close (this);
> if (rc != 0)
> throw error_t ();
> }
The C++ wrapper was created in pretty straightforward manner: wrap the
function, if it returns error, throw.
> There's a lot of debate about whether this is "good" or not, but I don't
> believe it's considered good current practice.
Yes. With destructors it's not a good practice.
> Should this be changed?
There should be asserts instead of throws IMO.
Martin
More information about the zeromq-dev
mailing list