Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!dinghy.cis.ohio-state.edu!mowgli From: mowgli@dinghy.cis.ohio-state.edu (Mowgli Assor) Newsgroups: comp.sys.atari.st Subject: Re: nullfilling Summary: An Example! Message-ID: <40149@tut.cis.ohio-state.edu> Date: 22 Mar 89 21:59:13 GMT References: <0217890118120601@dynasoft.UUCP> Sender: news@tut.cis.ohio-state.edu Reply-To: Mowgli Assor Organization: Ohio State University Computer and Information Science Lines: 39 (Just a little note, this is my first post to the net, so excuse any wierd stuff, other than my personality 9-) In article <0217890118120601@dynasoft.UUCP> dynasoft!john@stag.UUCP (John Stanley) writes: >[danw@tekchips.LABS.TEK.COM (Daniel E. Wilson) writes...] > [...Stuff Deleted...] > >> Anyone programming in C that assumes that malloced memory is zero is >> making a very big mistake. > > Agreed! Even in the example code shown in K&R, no attempt is made to >clear allocated memory. (That's what calloc() is for... :^) > >> Dan Wilson > >--- >John Stanley >Software Consultant / Dynasoft Systems I must say "absolutely agreed". I've been debugging a program written with Lattice for about 2 weeks now, & this discussion saved my bacon! I was getting a little problem where one of the pointers was ending up in the 7+Million range (on a 512K machine 9-( ). I could not find any logical (or otherwise 9-) explanation for it. Then I realized that I was sort of assuming that the malloc() calls were returning zeroed out memory, & I was only checking for NULLs. I went back & preset the pointers to NULLs before using them, & the problem has since disappeared. So, THANK YOU for reminding me, guys. Later, -=- Address: mowgli@puffer.cis.ohio-state.edu (Mowgli Assor in real life) The 2 precepts of Semi-Divinity: (1) Mind Thine Own Business. (2) Don't Worry About It.