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: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: [PATCH] use memset to zero the fields of a new frame_info
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: 20 May 2001 02:35:01 -0500
- Cc: Stan Shebs <shebs at apple dot com>,Michael Snyder <msnyder at cygnus dot com>, gdb-patches at sources dot redhat dot com
- References: <3B042FD4.81EE2FC3@cygnus.com> <3B04330A.21E8784E@apple.com><3B049F47.5040706@cygnus.com>
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.)