From owner-freebsd-hackers Sat Sep 28 09:06:51 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA19370 for hackers-outgoing; Sat, 28 Sep 1996 09:06:51 -0700 (PDT) Received: from root.com (implode.root.com [198.145.90.17]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA19331; Sat, 28 Sep 1996 09:06:47 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by root.com (8.7.5/8.6.5) with SMTP id JAA02238; Sat, 28 Sep 1996 09:07:58 -0700 (PDT) Message-Id: <199609281607.JAA02238@root.com> X-Authentication-Warning: implode.root.com: Host localhost [127.0.0.1] didn't use HELO protocol To: guido@gvr.win.tue.nl (Guido van Rooij) cc: dyson@FreeBSD.org, FreeBSD-hackers@FreeBSD.org Subject: Re: stack In-reply-to: Your message of "Sat, 28 Sep 1996 18:03:38 +0200." <199609281603.SAA05989@gvr.win.tue.nl> From: David Greenman Reply-To: dg@root.com Date: Sat, 28 Sep 1996 09:07:58 -0700 Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >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