This is the mail archive of the
libc-alpha@cygnus.com
mailing list for the glibc project.
Re: [Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free
- To: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Subject: Re: [Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free
- From: Jonathan Larmour <jlarmour@cygnus.co.uk>
- Date: Wed, 28 Apr 1999 18:40:31 +0100
- CC: libc-alpha@cygnus.com
- Organization: Cygnus Solutions Ltd.
- References: <u8vhegit3l.fsf@arthur.rhein-neckar.de>
Andreas Jaeger wrote:
>
> Andrew reported the appended problem and accoring to Unix98 realloc
> (p,0) should free the pointer p but we don't do.
>
> ISO C 9X defines realloc (ptr,0) as:
> If size is zero and ptr is not a null pointer, the object it
> points to is freed.
Actually, C89 defines realloc in this way too. We would be shooting
ourselves not to be C89 compliant!
Jifl
--
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK. Tel: +44 (1223) 728762
"I used to have an open mind but || Want a free open source no-royalty RTOS?
my brains kept falling out." || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/ These opinions are all my own fault