Re: [boost] [inspect] exceptions (FW: [Boost-users] no exceptions)

Dave Abrahams:
At Wed, 23 Mar 2011 14:29:20 -0700, Emil Dotchevski wrote:
It is not independent matter because that is exactly what BOOST_THROW_EXCEPTION guarantees, except when the library contains try..catch or rethrows using throw without arguments, which are rare cases. I agree that going the extra mile to workaround those additional cases is usually unreasonable.
I suppose that might be true, depending on your definition of "work properly." There's no such thing as "working properly without exceptions" if the library was coded for use with exceptions and you really need a recoverable response to, say, resource exhaustion.
That said, "libraries should generally use BOOST_THROW_EXCEPTION" is a good rule for Boost, and I wouldn't mind having something like it in the inspect tests, provided that libraries with a legitimate reason not to use it can be registered as exceptions to the rule.
I think you are both more knowledgeable about exceptions and this Boost library than I am, but here's my thinking. In the last 2 or 3 months I added a try/catch and throw without arguments to a file in my library -- http://webEbenezer.net/misc/ReceiveCompressedBuffer.hh . That's the only one so it is rare for me but there are a lot of libraries that are bigger than my library. So I'm not sure it is rare in other libraries. It seems to me that as a library grow this restriction is just waiting for you to run into it. I guess it's a trade-off though if I understand correctly. -- Brian Wood Ebenezer Enterprises http://webEbenezer.net (651) 251-9384

From: Brian Wood In the last 2 or 3 months I added a try/catch and throw without arguments to a file in my library -- http://webEbenezer.net/misc/ReceiveCompressedBuffer.hh .
You can eliminate the try/catch from the code. For example, instead of: try { // do sth dangerous using cmpRead } catch(...) { cmpRead = 0; throw; } write: auto tmp = cmpRead; cmpRead = 0; // do sth dangerous using tmp cmpRead = tmp; Best regards, Robert
participants (2)
-
Brian Wood
-
Robert Kawulak