On Jul 21, 2010, at 2:45 AM, Martin Sustrik wrote: > Matt Weinstein wrote: > >> I've implemented a first version of the zmq_nothrow. >> >> It's not brilliant, and maybe it's better not to do it, it's very >> un-C++-like. >> >> However, since I've done it, I'm attaching for your thoughts -- >> >> A few questions: >> >> - is __attribute__((warn_unused_result)) generally used? (I've used >> it >> here since you don't expect a class not to throw :-)) > > That's gcc-ism IMO. > I guess I'd end up with #pragmas too, so away it goes :-)
>> - I've added an error_ value to zmq_message_t. Not beautiful. Any >> alternatives? > > Yes. That's kind of strange. The only reason is to catch the errors > during the message initialisation? > Yup, if we can't throw... that's why this isn't a particularly good solution. Actually, it's a particular bad solution because you have to inspect the code to figure out what to do at each juncture. The right thing to do IMO is to write a wrapper class that works like mutex::guard, and guarantees e.g. zmq_close at end of block. >> Anyway, I'll use this domestically and wring out any misfeatures. >> >> Comments welcome -- please :-) > > Martin > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
