Does C++ support 'finally' blocks? (And what's this 'RAII' I keep hearing about?)
问题 Does C++ support \'finally\' blocks? What is the RAII idiom? What is the difference between C++\'s RAII idiom and C#\'s \'using\' statement? 回答1: No, C++ does not support 'finally' blocks. The reason is that C++ instead supports RAII: "Resource Acquisition Is Initialization" -- a poor name † for a really useful concept. The idea is that an object's destructor is responsible for freeing resources. When the object has automatic storage duration, the object's destructor will be called when the