Lambda the Ultimate

inactiveTopic Exception-Safety in Generic Components
started 8/30/2002; 3:47:11 PM - last post 8/30/2002; 3:47:11 PM
Manuel Simoni - Exception-Safety in Generic Components  blueArrow
8/30/2002; 3:47:11 PM (reads: 232, responses: 0)

[This paper] explores the meaning of exception-safety, reveals surprising myths about exceptions and genericity, describes valuable tools for reasoning about program correctness, and outlines an automated testing procedure for verifying exception-safety.

David Abrahams discusses real-world use of exceptions in the C++ Standard Template Library, but the points are also valid for Java and similar exceptions mechanisms.

Among other information, it introduces three levels of exception safety...

  • The basic guarantee: that the invariants of the component are preserved, and no resources are leaked.
  • The strong guarantee: that the operation has either completed successfully or thrown an exception, leaving the program state exactly as it was before the operation started.
  • The no-throw guarantee: that the operation will not throw an exception.

...and discusses when they are appropriate.

I really liked it because it is the first paper that makes these points explicit.

PS: The paper is from the excellent C++ Boost website. Their materials are high quality and a good read for anyone, especially "Java softies" like me ;)