I have a lot of globals in my program. Much of the program operation is related
to setting and modifying various parameters, switches, flags, etc.
Also changing operating modes, adding and removing indicators; in other words,
all kinds of stuff.
The program uses functions as subroutines to carry out the various operations.
They don't return values as many library functions do, they just perform some
operation. Subroutines.
I could put everything in a big structure, and pass the structure address around,
but that would basically give almost all the functions access to them. Which is
one of the complaints about globals.
One main part of the program's function is to generate fractal based images, and
allow magnification of any selected part. The other main part provides setting up
and editing a color spectrum which is used to color the image. Most operations are
activated by mouse and keboard; some of the new ones will be in menus.
It's not a complicated program, a main command interpreter and mouse interpreter
call all the appropriate functions. But their operations affect many of the (global)
variables.
Does the number of variables in question have anything to do with whether or not
globals are appropriate? In other words if one particular global variable was
appropriate, would a large number of such variables also be appropriate?
And also, what is the best way to deal with large numbers of variables that require
such large scope?