bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proper realloc(p,0) behavior?


From: Paul Eggert
Subject: Re: proper realloc(p,0) behavior?
Date: Fri, 25 Mar 2011 10:40:43 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9

On 03/25/2011 09:31 AM, Eric Blake wrote:
> xrealloc(NULL,0) _must_ return malloc(0) rather than blindly returning NULL.

Yes, that makes sense too.  Thanks for thinking it through.

The change you just installed causes xrealloc (NULL, 0)
to return realloc (NULL, 0) without failing, which boils
down to the same thing (and is arguably better, on weird
implementations where malloc (0) and realloc (NULL, 0)
have different semantics).

Who would have thought back in the early 1970s when these
primitives were designed that we'd still be arguing about
their semantics four decades latter?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]