🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #37317

Re: nullfilling

#37317
From: Mowgli Assor
Date: Wed, 22 Mar 1989 21:59
39 lines
2014 bytes
(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 <dynasoft!john@stag.UUCP>
>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! <Grin> 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. <Smile> I went
back & preset the pointers to NULLs before using them, & the problem has
since disappeared. So, THANK YOU for reminding me, guys.

					Later, <Mowgli>

-=-
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.
Technical Details
Message-ID: <40149@tut.cis.ohio-state.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!dinghy.cis.ohio-state.edu!mowgli
References: <0217890118120601@dynasoft.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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 <mowgli@cis.ohio-state.edu>
Organization: Ohio State University Computer and Information Science
Lines: 39