[vox-tech] global variables in C

Peter Jay Salzman vox-tech@lists.lugod.org
Fri, 20 Sep 2002 10:34:51 -0700


ok, first i'd like to apologize for bringing up such a tired subject,
but i'd like to understand this better.


conventional wisdom says that you should avoid using globals.

reading through some C books like the deitel book which is used at UCD
and SAMS "C primer plus", i find that they don't really address this
issue at all.  when i talk to people, i hear the same two reasons over
and over:

1. name clashing
2. readability

what i'd like to know is if this is all there is.  are there more
reasons why we should follow conventional wisdom?  or is this more of a
guiding principle and not something to be followed blindly?   it seems
like for some applications, like GUI and multi-thread programming, the
use of globals can really simplify things a lot.

please no sarcasm or flames -- just lucid explanations.  i'd like to
understand this better.

pete

-- 
Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D