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 then, why use the Cleanup Stack rather then smart pointers?
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 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.