Date: Sat, 28 Sep 1996 09:07:58 -0700 From: David Greenman <dg@root.com> To: guido@gvr.win.tue.nl (Guido van Rooij) Cc: dyson@FreeBSD.org, FreeBSD-hackers@FreeBSD.org Subject: Re: stack Message-ID: <199609281607.JAA02238@root.com> In-Reply-To: Your message of "Sat, 28 Sep 1996 18:03:38 %2B0200." <199609281603.SAA05989@gvr.win.tue.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
>David Greenman wrote: >> >I used exactly this program: >> >main() { >> > char buf[1000]; >> > >> > write(1, buf, 1000); >> >} >> > >> >The resulting file did not conatin only zero's. I think this is weird. >> >> You might think it's weird, but it is not a bug or even unexpected. Stack >> space is not guaranteed to be initialized to any particular value. > >I thought this was guarantueed because when the `feature' was dropped >to many programs discontinued working.. Huh? Not that I'm aware of. I think you might be confusing .bss allocated space which is created as zero-filled. If you move your variable declaration above to outside of main(), the space will be allocated from .bss and thus will be zero-filled. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609281607.JAA02238>