I keep reading here and there that global variables are bad. This program that I am writing has a lot going on and many of the variables are used across multiple modules. What are the problems with declaring these variables global?
I keep reading here and there that global variables are bad. This program that I am writing has a lot going on and many of the variables are used across multiple modules. What are the problems with declaring these variables global?
The only problem I would see would be if you used a variable in a module and did not assign it a value in the beginning of the subroutine.
Hope this helps.
FWIW, I agree with RomperStomper.
As a minimum, public variables should only be modified in one procedure.
Entia non sunt multiplicanda sine necessitate
I guess this works then. My program starts out with a form that asks the user to input various pieces of information. That information is assigned to the different global variables and then used in a number of different modules. None of the modules modify the variables, they only use the values in their calculations.
Last edited by shg; 11-25-2009 at 12:32 AM. Reason: deleted spurious quote
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks