This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Checking xmalloc's return status in c-pragma.c
- To: dstarner98 at aasaa dot ofe dot org
- Subject: Re: Checking xmalloc's return status in c-pragma.c
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Wed, 27 Oct 1999 15:01:10 +0100
- CC: gcc-patches at gcc dot gnu dot org
- Reply-to: nickc at cygnus dot co dot uk
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