On 11/6/09, Anselm R Garbe <ans...@garbe.us> wrote: > 2009/11/6 QUINTIN Guillaume <coincoin1...@gmail.com>: >> Someone just told me that, when writing C code, one should NOT use ANY >> global variables. He did not tell me to use global variables as few as >> possible, he did tell me to use ABSOLUTELY NO global variables in any > > Is he sure he never uses global variables? What about our old friend errno? >
better examples are stdin, stdout and stderr which are global pointers to mutable global objects and one usually uses them there are several functions in the standard that depend on global mutable state eg malloc, rand, atexit, setjmp, setenv, fesetenv, strtok, setlocale+functions with locale specific behaviour (one of the ugliest part of the c99 standard) and of course many function sets errno