February 2005
Beginner to intermediate
272 pages
4h 53m
English
To write perfectly exception safe code, it’s necessary to keep track of any allocated resources and to be prepared to release them if an exception occurs. This is often a straightforward process. We can either organize our code in such a way that no resource recovery is necessary (see Exception Safe Functions [39, 135]) or use resource handles to recover the resources automatically (see RAII [40, 139]). In extreme situations, we can get down and dirty with try blocks or even nested try blocks, but this should be an exception, not the rule.
We do, however, have an apparent problem with the use of the new operator. The new operator actually performs two separate operations (see Placement New [35, 119]); ...
Read now
Unlock full access