[Top][All Lists]
[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?
- Re: proper realloc(p,0) behavior?, (continued)
- Re: proper realloc(p,0) behavior?, Jim Meyering, 2011/03/24
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/24
- Re: proper realloc(p,0) behavior?, Paul Eggert, 2011/03/24
- Re: proper realloc(p,0) behavior?, Paolo Bonzini, 2011/03/25
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/25
- Re: proper realloc(p,0) behavior?, Paolo Bonzini, 2011/03/25
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/25
- Re: proper realloc(p,0) behavior?, Paul Eggert, 2011/03/25
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/25
- [PATCH] xmalloc: revert yesterday's regression, Eric Blake, 2011/03/25
- Re: proper realloc(p,0) behavior?,
Paul Eggert <=
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/25
[PATCH] realloc: document portability problem, Eric Blake, 2011/03/24
Re: proper realloc(p,0) behavior?, Bruno Haible, 2011/03/24
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/25
- Re: proper realloc(p,0) behavior?, Bruno Haible, 2011/03/25
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/25
- Re: proper realloc(p,0) behavior?, Paul Eggert, 2011/03/25
- Re: proper realloc(p,0) behavior?, Eric Blake, 2011/03/25
Re: proper realloc(p,0) behavior?, Bruno Haible, 2011/03/24