开发者

Are local objects destructed in the case of a leave on Symbian?

开发者 https://www.devze.com 2023-01-07 03:22 出处:网络
On Symbian, if a function exits because of a leave, are the destructors of its local (automatic) variables called?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消