Destructors
It has nothing to do with the stack; statically-allocated objects such as globals are not stored on the stack.
Quote:Original post by Rainault
Is that because of the FIFO nature of the stack?
No. It's also true of variables that are statically allocated (i.e. globals) or variables that got constructed in the same scope. Destroying variables in reverse order is the simplest way to take care of any dependence issues. If B depends on A, B must be created after A and destroyed before it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement