: The reason it's considered bad programming is because of linkage
: between modules (in this case a "module" means a procedure and
: function). It has nothing to do with memory.
: No module should have access to any variable that it does not need
: to have access to. That way if a programmer changes a variable in
: one module it has no effect on a similarly named variable in another
: module. A global variable can be changed by any procedure/function.
: It's not hidden.
: Read ELEMENTS OF PROGRAMMING STYLE and SOFTWARE TOOLS IN PASCAL,
: both by Brian Kernighan and P.J. Plauger.
Well, then just don't use names for local variables that match those of global variables. In my game code I couldn't imagine how I'd do it without global variables. I have hundreds of variables that are used by 75% of my procedures and functions (also in the hundreds). Passing them between these procedures and functions would be a nightmare. Having them as global variables removes this headache. When I have to access one, I just do it. I haven't had any problems with local and global variables sharing names. I just don't see how this is considered a problem, but maybe that's just me.