Global variables (was Re: Caution for those considering MSC 5.0)
Lee Carver
lee at ssc-vax.UUCP
Fri Feb 19 10:11:30 AEST 1988
> All[*] global and static data in C is either initialised by the programmer
> (in which case, if it does not have the proper value on startup, the
> compiler is broken) or not initialised by the programmer (in which case,
> if it does not have zero values[**] on startup, the compiler is broken).
[flame on]
So, you like the system to do things FOR you. I bet you like
implict declarations. When was the last time you actually used
'int' to declare an integer variable?
> >Rule of thumb is NEVER assume any UN-initialized variable contains
> >zero (or NULL)...
Thataway, let him have it!
> You can do this if you wish. Remember, *automatic* variables are
> indeed full of trash.
NEVER, NEVER, NEVER assume the system is going to put something
there unless you explicitly request it. It stops a lot of bugs dead
in their tracks. You might get away with it if you don't, but how
will you be sure?
More information about the Comp.lang.c
mailing list