Date: Sat, 28 Sep 1996 17:59:36 +0200 (MET DST) From: J Wunsch <j@uriah.heep.sax.de> To: FreeBSD-hackers@FreeBSD.org Subject: Re: stack Message-ID: <199609281559.RAA03161@uriah.heep.sax.de> In-Reply-To: <199609281520.RAA05793@gvr.win.tue.nl> from Guido van Rooij at "Sep 28, 96 05:20:52 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
As Guido van Rooij wrote: > When I allocate something on the stack, isn't it supposed to be completely > zero? > like: > main(int argc, char **argv) { > char buf[1000]; > > ... > } > > Then buf should be zero, or am I missing something here? Automatic variables are always uninitialized. You're confusing this with static variables (including global ones). The matter is different in C++, where class objects are always being created by constructors, thus you can adjust the behaviour to what you think fits best (though this can quickly become a run-time hog if you are not carefully enough). -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609281559.RAA03161>