Node:Global variables and style, Next:, Previous:Declarations and initialization, Up:Style



Global variables and style

Global variables have caused almost as much controversy as the goto statement. Some programmers say you should never use them. Other programmers use them on a regular basis. In fact, while global variables should not be overused, they can simplify your code considerably. The following guidelines may help you decide where to use globals.

Finally, don't use local variables or parameters that have the same names as global identifiers. This can make debugging very difficult.