pkgsrc-Users archive

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

Re: Problems with 2006Q3



> A free(3) which doesn't support being called with a NULL pointer is just
> broken. What malloc does for size 0 is implementation defined.
> Consistent with the spirit of the standard could be a wrapper which
> turns allocations for 0 into allocations of 1, if a program depends on
> that.

To amplify this, IEEE 1003.1-2004 says for free():
    If ptr is a null pointer, no action shall occur.
and for malloc():
    If size is 0, either a null pointer or a unique pointer that can
    be successfully passed to free() shall be returned. 




Home | Main Index | Thread Index | Old Index