Automating exception-safety classification

  • Authors:
  • Gustav Munkby;Sibylle Schupp

  • Affiliations:
  • -;-

  • Venue:
  • Science of Computer Programming
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Exception handling mechanisms provide a structured way to deal with exceptional circumstances, making it easier to read and reason about programs. Exception handling, however, cannot avoid the problem that the transfer of control might leave the program in an inconsistent state-resources might leak, invariants might be violated, the program state might be changed. Since client code often needs to know how a program behaves in the presence of exceptions, the exception-safety classification distinguishes three different classes of safety guarantees; this classification is used, for example, during the review process in the Boost organization for standardized libraries in C++. Classifying the safety level of a procedure requires understanding program invariants and tracking program state at any given point in the code, which is error-prone when done by hand. Yet, no tool support is available to date. In this paper we present the first automated analysis for exception guarantees. Since the safety level of an arbitrary procedure is undecidable, the analysis conservatively approximates exception safety . The analysis is based on the theory of backward data-flow analysis and recognizes two of the three safety guarantees, the strong and the no-throw guarantee, and provides counterexamples otherwise. A prototype implementation is available.