http://en.wikipedia.org/wiki/Global_variable
"The use of global variables makes software harder to read and understand. Since any code anywhere in the program can change the value of the variable at any time, understanding the use of the variable may entail understanding a large portion of the program"
OK lets take this 'gem'.
It is perfectly easy to see where the variable is used in the program, you just do a search on it. The beauty of global variables is that they can be modified anywhere, it is not a failing it is a strength. Only takes a few clicks of the mouse to see where the variable is used.
Futhermore to say that local variables are easier to understand is wrong, local variables
can change other variables in the program via return values. Not only that it could change
any variable of the same type throughout the program.
Now if you want to find out how that local variable affects the rest of the program you have to look at all the calls to that function and various different variables affected by that call,
so now you have to do multiple searches on different variable names!! Futhermore those variables will also be passed
into other functions affecting other variables. You effectively could have a chain reaction.
A nuclear explosion of complexity taking place in the program!!!
Most of the 'bad practice' I see is people trying to make global variables local!!!!
You see some horrendous things, great wadges of data beinig passed around, the names constantly changing, making it almost impossible to keep track of what is going on.
I have seen stuff being passed down through 4 or 5 levels of functions, the name changing each time. In making their program 'less complex' and easy to follow they create the biggest labyrinth of complexity ever seen.
If you want to make you program imcomprehensible avoid using global variables.
Mind you when you come back to it in a few months you won't be able to undestand it either