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: cpplib and a couple others: squelch -pedantic warnings


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

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