First page Back Continue Last page Summary Graphics
The heights of Exception-safety
The basic exception-safety guarantee
- m() doesnt complete its task; but
- resource shall not leak; and
- data structures remain useable.
The strong exception-safety guarantee
- no change to the state of the program.
The nothrow exception-safety guarantee
- m() never throws an exception
Notes:
As we proceed well find frequent outcrops of the rock that supports our mountains, which is named after the area in which it is found and is called the no-throw exception safety guarantee - as the name suggests this implies that the corresponding function will never propagate an exception.
Clearly operations on the base types provide this guarantee, as will any sequence of no-throw operations. If it were not for the firm footing that these outcrops of the no-throw exception safety guarantee provide we would have great difficulty ascending the heights.
Although the no-throw exception safety guarantee was known and used in earlier work I think it was first made explicit and named by Herb Sutter (Exceptional C++ - ISBN 0-201-61562-2).
We've now seen our landmarks, please take a moment to be sure you understand them they are fundamental to what follows.