This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Checking xmalloc's return status in c-pragma.c


Hi David,

: 1999-10-26  David Starner  <dstarner98@aasaa.ofe.org>
: 
:         * c-pragma.c (push_alignment): Don't check the return value
:         of xmalloc.

: push_alignment in c-pragma.c checks xmalloc's return status to
: see if there was enough memory to allocate something. Unfortunetly,
: if I'm not mistaken, xmalloc doesn't return if there wasn't enough
: memory.

Whilst this is true, I do not really see the benefit in deleting this
code.  The check is not going to take a lot of resources to compute,
and it is a good example of paranoid programming.  Just because
xmalloc() currently will not return NULL, this does not mean that in
the future it may be re-implemented so that it can return NULL, or
maybe a bug might be introduced that causes it to return NULL.

The check does not harm, does not slow down the compiler and might
catch future bugs.  I would say leave the check in.

Cheers
	Nick


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