This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpplib and a couple others: squelch -pedantic warnings
- To: Gabriel Dos Reis <gdr at codesourcery dot com>
- Subject: Re: cpplib and a couple others: squelch -pedantic warnings
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Thu, 4 May 2000 16:23:09 -0400
- Cc: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>, grahams at rcp dot co dot uk, gcc-patches at gcc dot gnu dot org, jason at cygnus dot com, zack at wolery dot cumb dot org
- References: <200005041937.PAA10931@caip.rutgers.edu> <xaj3dnyhxxy.fsf@korrigan.inria.fr>
On Thu, May 04, 2000 at 10:17:45PM +0200, Gabriel Dos Reis wrote:
> "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
>
> [...]
>
> | Do you think we should define a single xfree which takes a const void*
> | and checks whether the parameter is NULL? Is allowing NULL to be
> | passed to {x}free something we want to silently allow? I know some
> | implementations of malloc/free allow this, but I'm not sure whether
> | its encouraged. I.e. Will doing so paper over bugs?
>
> void *ptr = NULL;
> free (ptr);
>
> is valid and should be a no-op. I don't think a warning is
> particularily useful here.
Go back to the archives in the last few weeks, and you will see a discussion
that there are systems out there that GCC runs on (such as SunOS) that will
segfault if free is called with a NULL pointer. Whether it is a pre-ANSI
system or just a bug in the library, is immaterial, we have to accomidate those
systems.
--
Michael Meissner, Cygnus Solutions, a Red Hat company.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482