[Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free
Jonathan Larmour
jlarmour@cygnus.co.uk
Wed Apr 28 10:43:00 GMT 1999
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
More information about the Libc-alpha
mailing list