Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Exception-safety guarantees » ?

Aussi appelé : exception-safety guarantee

Definition 1.16 University Computer Science — Year 2 · Chapitre 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.
Lire dans le chapitre →