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


> Whether or not this is technically a bug, completely freeing the memory 
> on realloc(p, 0) seems the obviously preferred behavior.  Is there any 
> reason for keeping the current behavior?

Well, as the comment in the source says, when malloc(0) returns a
unique pointer (like it does currently in glibc) it seems consistent
that realloc(...,0) does so too.  So, if the standard really requires
that realloc(...,0) frees then we should also consider changing
malloc(0) to return NULL IMHO.

Regards,
Wolfram.
-- 
`Surf the sea, not double-u three...'
wmglo@dent.med.uni-muenchen.de


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