Skip site navigation (1)Skip section navigation (2)
Date:      18 Feb 1999 15:32:17 +0100
From:      Dag-Erling Smorgrav <des@flood.ping.uio.no>
To:        perlsta <bright@cygnus.rush.net>
Cc:        Kevin Day <toasty@home.dragondata.com>, mike@smith.net.au, hackers@FreeBSD.ORG
Subject:   Re: vm_page_zero_fill
Message-ID:  <xzpemnnwzny.fsf@flood.ping.uio.no>
In-Reply-To: perlsta's message of "Tue, 16 Feb 1999 12:49:59 -0500 (EST)"
References:  <Pine.BSF.3.96.990216122756.10060u-100000@cygnus.rush.net>

next in thread | previous in thread | raw e-mail | index | archive | help
perlsta <bright@cygnus.rush.net> writes:
> > > > > the C spec says that the BSS contains zeroes, so it's
> > > > > typically assumed that all unitialised globals will be zeroed.
> > If this is something that can be relied upon, why add implicit zero's in the
> > code?
> because lazy coders have depended on that feature for years now, and
> changing it would break too many things.  not only that but it's nice to
> know that _some_ things will be zero'd out for you.

If you have a *lot* of global data in your app, you basically have a
choice between a) initializing them in main(), b) spending some CPU
cycles zeroing the BSS at load time, or c) initializing them
explicitly in the source code, which will move them into DATA and eat
up disk space. Kind of stupid to waste disk space on a lot of zeroes.
That leaves you with a) and b), and b) makes it easier on the
programmer (though personally I wouldn't consider a) a big nuisance)

DES
-- 
Dag-Erling Smorgrav - des@flood.ping.uio.no


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpemnnwzny.fsf>