Eric Blake <[EMAIL PROTECTED]> wrote:
> According to Ben Pfaff on 8/22/2007 5:19 PM:
>> Bruno Haible <[EMAIL PROTECTED]> writes:
>>
>>> Jim Meyering wrote:
>>>> A *lot* of code expects malloc and realloc to set errno when they fail.
>>> Such code is not portable to plain ISO C 99 systems.
>>
>> We could extend gnulib's existing malloc/realloc wrappers to
>> ensure that malloc/realloc set errno when they fail, if it is
>> worthwhile to do so.
>
> I would somewhat like this idea - it is much nicer assuming that malloc
> reliably sets errno to ENOMEM on failure than having to patch all callers
> of malloc to do the same.

Yes.  This is a fundamental goal of gnulib:
If there is some portability problem, don't penalize *all* software and
all systems.  Instead, keep the client software clean, and penalize
only the systems that have the problem.  The losing system (mingw,
in this case) can endure a little overhead in malloc/realloc wrappers.
That's far better than polluting all malloc-using application code with
obscure, seemingly-unnecessary code to set errno upon malloc failure.


Reply via email to