tech-userlevel archive

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

Re: Return Value of realloc(3)



On Sun, Dec 30, 2012 at 2:45 PM, John Nemeth <jnemeth%victoria.tc.ca@localhost> 
wrote:
> On May 22,  9:18am, Abhinav Upadhyay wrote:
> } On Sun, Dec 30, 2012 at 1:26 PM, Alan Barrett <apb%cequrux.com@localhost> 
> wrote:
> } > On Sun, 30 Dec 2012, Abhinav Upadhyay wrote:
> } >>
> } >> My point was that we should document this exact behaviour as mentioned
> } >> in the standards.
> } >> "If size is 0, either NULL or a unique pointer that can be
> } >> successfully passed to free(3) is returned."
> } >
> } > I agree.  And we might as well also document what happens when zero is
> } > passed to malloc or calloc.
> } >
> } > If we also document which of the two behaviours is used by NetBSD, then we
> } > should be careful not to encourage callers to reply on that implementation
> } > decision, because it may change in the future while remaining compatible
> } > with relevant standards.
> }
> } Also, what about erealloc(3) in libutil ? Looking at its
>
>      That's part of the implementation.  It's allowed to make assumptions.

Yes, but shouldn't it be documented what to expect when calling it
with a boundary value like 0 ?

--
Abhinav


Home | Main Index | Thread Index | Old Index