This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] use memset to zero the fields of a new frame_info
- To: Stan Shebs <shebs at apple dot com>
- Subject: Re: [PATCH] use memset to zero the fields of a new frame_info
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 18 May 2001 12:04:23 +0800
- Cc: Michael Snyder <msnyder at cygnus dot com>,gdb-patches at sources dot redhat dot com
- References: <3B042FD4.81EE2FC3@cygnus.com> <3B04330A.21E8784E@apple.com>
> Ah, the end of an era. Gilmore originally objected to this kind of
> thing, on the theory that it was "machine-gunning" memory and wasn't
> necessary - only set fields that you know need to be zeroed. I'm on
> the fence, because it can save bugs and random scattered init code
> if you can assume that newly-allocated data all has known values, and
> clearing small-to-medium-size structs isn't expensive usually.
I remember that, I got my wrist slapped for sending such a patch to BFD.
> In any case, the policy ought to be clarified one way or the other.
If you look at PSIM which uses ZALLOC(TYPE) (allocate sizeof(TYPE) bytes
of zero initialized memory) you'll see where I sit.
When it comes down to it, I'm more concerned with ensuring that all
memory is initialized to a well defined, machine independant, value then
what the value actually is. Zero happens to be convenient.
Andrew