enum { BFD_ENDIAN_BIG, ...}

Alan Modra amodra@bigpond.net.au
Mon Dec 17 17:44:00 GMT 2001


On Mon, Dec 17, 2001 at 04:45:21PM -0800, Richard Henderson wrote:
> On Tue, Dec 18, 2001 at 10:59:41AM +1030, Alan Modra wrote:
> > While we're on this subject, note that initialising pointers (and FP) to
> > all-bits-zero via memset is not strictly portable.  Not all architectures
> > represent a NULL pointer as all-bits-zero.  The C-FAQ mentions a number
> > of such machines.  http://www.eskimo.com/~scs/C-faq/top.html
> 
> Whatever.  None of them are live.

Heh.  I suppose I should have admitted noticing this strict portabilty
problem at various times, and couldn't be bothered fixing occurrences.
The thing is, a number of places in binutils do

memset (structp, 0, sizeof (*structp);

structp->ptr1 = NULL;
structp->ptr2 = NULL;
.
.

as if at some stage binutils authors were concerned about this
portability issue.  Typically, not _all_ pointers in the struct are
set to NULL, likely due to bitrot.  That's mildly confusing, and should
probably be fixed.  My inclination is to remove such "unnecessary"
initialisation.

Alan



More information about the Gdb mailing list