This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] use memset to zero the fields of a new frame_info


> 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]