Are local objects destructed in the case of a leave on Symbian?
On Symbian, if a function exits because of a leave, are the destructors of its local (automatic) variables called?
From what I've tried on the emulator, they are. But开发者_StackOverflow中文版 then, why use the Cleanup Stack rather then smart pointers?
Yes, automatic variables are properly destructed. Since (I think) version 9.1 of Symbian OS, leave is implemented using C++ exceptions.
Earlier versions of Symbian did not support exceptions at all, hence the whole cleanup stack mechanism. Automatic variables would not have had their destructors called when leaving.
精彩评论