>>However, I sincerely hope that no function throw declarations, except throw() in destructors
I strongly second this! Any other throw-specs are just hidden traps in your app, waiting to kill it. There is a lot of consensus on this -- see www.boost.org, Exceptional C++ (Sutter), etc. Regards, Chris -----Original Message----- From: Michael Hunley [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2003 11:37 AM To: [EMAIL PROTECTED] Subject: Re: [inbox] Re: Exceptions At 01:03 PM 11/7/2003 -0600, you wrote: > > The return types of functions need to be reconsidered or honored if > > the function does nothing but throw an exception. Function > > declarations should report that they throw the exception so that an > > application written to them can catch these run-time exceptions. > >I'd like to have an alphabetical list of classes, with each method >listed and the asserts or exceptions each method can throw. Such a list >would be especially valuable in abstract classes if it listed the >derived classes and the exceptions thrown in each (by method). I don't >want it badly enough to make it up myself, so therefore it isn't very important... There is a fundamental problem with explicit throw declarations; in my opinion the mechanism in C++ is broken. If you declare a member function and declare it like: class foo { bool IsValid() throw(std::bad_alloc); } And then you mod the code to also throw std::runtime_error you will automatically get an unhandled exception. It gets even worse...the throw decl's must be hierarchical. That means that your function *must* declare every exception it throws *and* every exception that any function it calls can throw, otherwise you get an unhandled exception. Absolutely horrible and useless, not to mention an upkeep nightmare. I think that documenting throws in the header (a la doxygen semantics) is awesome and we endeavor to do so in all of our code. I would like to see that happen in Crypto (and a ton of other libs as well). However, I sincerely hope that no function throw declarations, except throw() in destructors, is implemented until the C++ spec is fixed (yeah, right). my 2 pesos, for what they're worth. michael
