quote:Original post by DrPizza
"if". So, like I said, it''s not just GC. If your destructor did something such as print a message to the console to indicate that it was being destroyed (that whole "side-effects" thing again) then you''d still need to maintain a stack of the objects to be destroyed, so that the messages can be printed to the console in the correct order.
Which is yet another example of C++''s feature set hindering this optimization. Languages with lazy or asynchronous GC prohibit programmers from expecting finalizers to run immediately, thus freeing up the compiler/interpreter to run them whenever is most convenient. By rigorously specifying object destruction time, in contrast, C++ limits itself to control flows that can properly respect these specifications.
How appropriate. You fight like a cow.