bug-gnulib
[Top][All Lists]
Advanced

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

Re: getdelim doesn't set errno on failure?


From: Bruno Haible
Subject: Re: getdelim doesn't set errno on failure?
Date: Wed, 24 Aug 2005 15:40:52 +0200
User-agent: KMail/1.5

Jim Meyering wrote:
> Note that POSIX *does* require a failed malloc call to set errno to
> ENOMEM, albeit with CX shading (meaning IEEE Std 1003.1-2001).
>
>   http://www.opengroup.org/susv3xsh/malloc.html
>
> Let's try not to let substandard systems dictate interface design.
> If some system has a poor implementation of a function like malloc
> we can easily ensure that it is replaced.

I'm not in favour of a wrapper around malloc(), that would add overhead to
a function called as frequently as malloc(), just to set 'errno'.

ISO C 99 is not a "substandard", and Windows malloc() is not "poor" just
because it does not set errno.

What value do you expect in errno after malloc() failed? ENOMEM is
the most frequent and maybe also the only reasonable choice when malloc()
fails. What's the purpose then of setting errno then?

ISO C 99 is not a "substandard", and Windows malloc() is not "poor" just
because it does not set errno.

Bruno





reply via email to

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