Hi Wilco,

On Wed, Jun 25, 2025 at 06:07:06PM +0000, Wilco Dijkstra wrote:
> In principle a realloc that shrinks a non-NULL block does never need to fail.
> If it can't shrink the current block (either because internal design means it
> can't make it any smaller or because it doesn't have memory for a new
> smaller block) then it should preferably return the original pointer instead
> of returning NULL and taking the failure path.
> 
> So I'm wondering whether we should more clearly specify this - whenever
> it's possible to not fail, don't return NULL?

As Rich Felker said, musl has very good reasons for failing, several of
them.  Look at his comments in the thread.


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to