Global variables (was Re: Caution for those considering MSC 5.0)

duncs home dunc%moria at Sun.COM
Wed Feb 24 05:25:16 AEST 1988


In article <987 at ssc-bee.ssc-vax.UUCP> lee at ssc-vax.UUCP (Lee Carver) writes:
>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?

According to K&R 8.6:
	"Static and external variables which are not initialized are
	guaranteed to start off as 0; ..."

However it's still a good idea to do your initializations explicitly;  it
helps keep programmers who are unfamiliar with the fine details of C from
getting needlessly confused.  (And since a lot of those programmers seem to
be writing micro C compilers, it makes you program more portable 8^).



More information about the Comp.lang.c mailing list