[[ARM]] P358 says that all local non-static objects on the current call stack fully constructed since start of the try-block are “registered” for stack unwinding. The registration is fine-grained in terms of partial destruction —
- for any array with 3 out of 9 objects fully constructed, the stack unwinding would only destruct those 3
- for a half constructed composite object with sub-objects, all constructed sub-objects will be destructed
- Any half-constructed object is not registered since the dtor would be unsafe.
I guess this registration is an overhead at run time.
For the stack objects created in a noexcept function, this “registration” is not required, so compiler may or may not call their destructors.
— in http://www.stroustrup.com/C++11FAQ.html#noexcept Stroustrup hints at the scaffolding
- noexcept is a efficiency feature — widely ans systematically used in standard library to improve performance
- noexcept is crude and “very efficient”
- dtor may not be invoked upon stack unwinding
- stack unwinding may not happen at all