2 ms·
Basically for the same reason you would prefer RAII to new/delete. You can easily forget to change the value of a global variable back to its old value, whereas
by tsimionescu 6y ago
Basically for the same reason you would prefer RAII to new/delete. You can easily forget to change the value of a global variable back to its old value, whereas dynamic variable bindings automatically revert to their old values after you leave the scope of their declarations.