Article View: comp.sys.atari.st
Article #37191Re: nullfilling
From: John Stanley
Date: Fri, 17 Mar 1989 06:18
Date: Fri, 17 Mar 1989 06:18
29 lines
1637 bytes
1637 bytes
[danw@tekchips.LABS.TEK.COM (Daniel E. Wilson) writes...] > K&R say nothing about clearing memory. Only static variables are > cleared and this is done by the compiler. Half right Dan. K&R, page 198, paragraph 3 (sort of): "Static and external variables which are not initialized are guaranteed to start off as 0; automatic and register variables which are not initialized are guaranteed to start off as garbage." Uninitialized data space is cleared (typicaly) by the operating system for security reasons and to prevent having to have each and every program do it (not the compiler)... On the few systems where the OS is known to not clear the uninitialized data space, then a part of the startup module in the program is used, but again, it's not "the compiler" that does the clearing.... > 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
Technical Details
Message-ID:
<0217890118120601@dynasoft.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!eta!com50!pwcs!stag!dynasoft!johnShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!eta!com50!pwcs!stag!dynasoft!john From: dynasoft!john@stag.UUCP (John Stanley) Newsgroups: comp.sys.atari.st Subject: Re: nullfilling Message-ID: <0217890118120601@dynasoft.UUCP> Date: 17 Mar 89 06:18:12 GMT Reply-To: dynasoft!john@stag.UUCP (John Stanley) Organization: DynaSoft Systems, Minneapolis, MN. Lines: 29 X-Member-Of: STdNET (ST Developer's Network)