On 2016-01-04 2:55 PM, Mike Shaver wrote:
Has there been some innovation in EH since Cargill's spine-chilling
exploration of making a simple container strongly exception safe? I
recall the consensus being that it was quite difficult to actually be
strongly exception safe, but it sounds like that's no longer the case now.

See Dave Abrahams' write-up on the matter which is sort of the answer to Cargill's findings (at least one cited by proponents of C++ exception handling: <http://www.boost.org/community/exception_safety.html>). (<http://www.gotw.ca/gotw/082.htm> is also a related and great read.)

Without meaning to open up a discussion about C++ exception safety (since it seems like nobody is actually proposing that we should use it, at least right now!), writing exception safe code is not just a matter of using RAII and dtors to clean up. Please see <http://herbsutter.com/gotw/_102/> for example. Also, see things like exceptions escaping from destructors and so on. And most importantly, logic errors caused by the state of the program being left in an inconsistent form after an exception is risen and handled properly as far as the language is concerned.

To summarize, it's _possible_ to write exception safe code is all of the engineers working on your code know the recipe for doing so, but such code needs to be designed for exception safety (since there are clearly APIs that can never be made exception safe, for example without changing the APIs), and for converting existing code, you also need to have a reason why the time and money spent doing so is worth it...

</soapbox>

Ehsan
_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to