From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: Stan Shebs Cc: Michael Snyder , gdb-patches@sources.redhat.com Subject: Re: [PATCH] use memset to zero the fields of a new frame_info Date: Thu, 17 May 2001 21:04:00 -0000 Message-id: <3B049F47.5040706@cygnus.com> References: <3B042FD4.81EE2FC3@cygnus.com> <3B04330A.21E8784E@apple.com> X-SW-Source: 2001-05/msg00352.html > 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