When are global variables acceptable?
Posted
by dsimcha
on Stack Overflow
See other posts from Stack Overflow
or by dsimcha
Published on 2008-12-10T19:07:55Z
Indexed on
2010/04/08
19:23 UTC
Read the original article
Hit count: 243
Everyone here seems to hate global variables, but I see at least one very reasonable use for them: They are great for holding program parameters that are determined at program initialization and not modified afterwords.
Do you agree that this is an exception to the "globals are evil" rule? Is there any other exception that you can think of, besides in quick and dirty throwaway code where basically anything goes? If not, why are globals so fundamentally evil that you do not believe that there are any exceptons?
© Stack Overflow or respective owner