Name: Anonymous 2012-02-21 2:10
Imagine a virtual machine that uses scopes, with variables indexed by their name's starting character for quick access times. Every call, a scope is pushed onto the scope stack. Every return, that scope is popped and destroyed, including the variables it holds.
So, why do people use anything else? Can it not possibly be this simple? `What about pointers', you say; every variable is in a scope, therefore every pointer points to something in a scope (only concerning heap allocated variables for this sake) . Nullify the pointers. The pointed to will be deleted.
Simple.
So, why do people use anything else? Can it not possibly be this simple? `What about pointers', you say; every variable is in a scope, therefore every pointer points to something in a scope (only concerning heap allocated variables for this sake) . Nullify the pointers. The pointed to will be deleted.
Simple.