Subject: Re: Question about initializing variables
To: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
From: Joao Carlos Mendes Luis <jonny@gaia.coppe.ufrj.br>
List: tech-userlevel
Date: 04/08/1996 20:10:48
#define quoting(Chris G Demetriou)
// >  > 	...
// >  > 	/* counters */
// >  > 	long ntransmitted = 0;
// >  > 	...
// >  > 	main(argc, argv)
// >  > 	...
// > 
// > Doing this would place the variable int the data segment ... that could 
// > nickel-and-dime us into a lot of extra on-disk code bloat.
// 
// And not only that, it would have no useful effect!
// 
// BSS variables are defined to have a starting value of zero.
// (I forget where that's defined; maybe ANSI... in any case, where it
// is, they're most likely called unintialized globals, or something...)

  Just remember that this is not true on all operating systems.  Once
I had a program that worked perfectly on NetBSD but did not work on
SunOS 4.1.2.  The problem: non-initialized variables that should have
zeros as value...

  Surelly not a problem if intended to use only in internal programs.

// In other words, as charles said: "It's not a bug."

  Personally, I call it programming discipline: "NEVER leave a variable,
any variable, without initialization !"

					Jonny

--
Joao Carlos Mendes Luis			jonny@coe.ufrj.br
+55 21 290-4698 ( Job )			jonny@cisi.coppe.ufrj.br
Network Manager				UFRJ/COPPE/CISI
Universidade Federal do Rio de Janeiro