From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roland McGrath To: hjl@lucon.org (H.J. Lu) Cc: ian@cygnus.com (Ian Lance Taylor), bfd@cygnus.com Subject: Re: A patch for elf.c Date: Wed, 09 Dec 1998 08:04:00 -0000 Message-id: <199812091603.LAA10873@baalperazim.frob.com> References: X-SW-Source: 1998/msg00077.html > To me, clearing memory is the super set of setting one field to > zero. I am a better safe than sorry person. I have no time > to second guess if there is another field I should clear. It is indeed the superset of setting one field to zero. The question is whether, generically speaking, setting a field to zero is the appropriate way to initialize it. It is not appropriate in all cases, so clearing memory is not necessarily a superset of appropriately initializing each field. If I may presume to explain another's position, I think Ian (like me), also considers himself a "better safe than sorry" person. For us, that means it is better to be safe by individually addressing each case with a human eye and being sure that case is handled properly, than to be sorry by presuming that some nonspecific blanket solution like zeroing everything will be the appropriate way to initialize each and every field. (What I prefer to do myself is use a debugging version of malloc that fills newly-allocated space with a distinctive nonzero bit pattern, e.g. 0xa5a5a5a5, that makes it unlikely that the program could happen to work if a field is left uninitialized.)