[Exceptional C++ Style] Item 12: Exception Safety: Is it Wort hit?
Paul Grenyer
paul at paulgrenyer.co.uk
Fri Dec 3 03:47:06 EST 2004
Hi Peter
> The article suggests, nay states, that all code needs to be exception
> safe.
> This only true where the application needs to carry on after an exception.
> This depends on what exceptions are used for of course, but in my
> experience
> they are used to report very bad things in libraries, and the application
> tells the user and gives up.
This is my experience too, but I can see where this wouldn't be the case in
a GUI based app. For example if the app failed to save a file for some
reason (as per previous conversations) then it would be unrealistic for the
application to exit and dump all the users data.
> In that case it doesn't much matter if it leaks
> memory or other resources, or classes become unstable, because they are
> not
> called any more.
This is a matter of opinion. I personally like to clean up properly, even
when an application has failed. Kevlin and I had a disagreement a few weeks
back (on accu-general I think??) about whether failed unit tests should
clear up properly. I think they should...
Regards
Paul
Paul Grenyer
email: paul at paulgrenyer.co.uk
web: http://www.paulgrenyer.co.uk
Elephant: http://www.paulgrenyer.dyndns.org/elephant/
I put my hand upon the lever, said let it rock and let it roll.
More information about the Effective-cpp
mailing list