This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


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

Re: [Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free


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


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