Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. Resource
Acquisition Is Initialization is a programming idiom used in several
object-oriented languages like C++, D and Ada. The technique was
invented by Bjarne Stroustrup to deal with resource allocation and
deallocation in C++. In this language, the only code that can be
guaranteed to be executed after an exception is thrown are the
destructors of objects residing on the stack. Resource management
therefore needs to be tied to the lifespan of suitable objects in order
to gain automatic allocation and reclamation. They are acquired during
initialization, when there is no chance of them being used before they
are available, and released with the destruction of the same objects,
which is guaranteed to take place even in case of errors.