среда, 22 октября 2014 г.

Ссылка. Why doesn't C++ provide a "finally" construct?

http://www.stroustrup.com/bs_faq2.html#finally

"Because C++ supports an alternative that is almost always better: The "resource acquisition is initialization" technique (TC++PL3 section 14.4). The basic idea is to represent a resource by a local object, so that the local object's destructor will release the resource. That way, the programmer cannot forget to release the resource."

Комментариев нет:

Отправить комментарий