Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Exception-safety guarantees?

Ook bekend als: exception-safety guarantee

Definition 1.16 University Computer Science — Year 2 · Hoofdstuk 1 — From C to C++: Classes and Resource Management

An operation gives the basic guarantee if, when it throws, no resource is leaked and every object it touched still satisfies its invariant, though its value may have changed. It gives the strong guarantee if, when it throws, the state is exactly as before the call (“commit or roll back”). It gives the no-throw guarantee if it never throws; a function declares it with noexcept.

The roster of  before the call and after a call throws on the empty name. The basic guarantee leaves some valid state, here with Cora and Dev added; the strong guarantee leaves the state of before.
The roster of Listing 1.11 before the call and after a call throws on the empty name. The basic guarantee leaves some valid state, here with Cora and Dev added; the strong guarantee leaves the state of before.
Lees in het hoofdstuk →