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



Andrew Cagney <ac131313@cygnus.com> writes:
> 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.

Using memset(addr, 0, size) to clear a structure is certainly not
machine-independent.  You have no idea whether the compiler represents
integer zero, null pointers, floating-point zeros, etc. as a series of
zero bytes or not.  Using memset this way is not typesafe.

(No, I don't think this ``concern'' has any practical consequence.  I
have no opinion on the actual issue.  I just want to be a smarty
pants.)


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