PATCH: Better messages for discarde section

Ian Lance Taylor ian@airs.com
Tue Jun 3 17:08:00 GMT 2003


Nick Clifton <nickc@redhat.com> writes:

> Hi H.J.
> 
> >> asprintf() returns 0 if it failed to allocate the memory, not -1.
> 
> > Linux's asprintf returns -1 on error.
> 
> Really ?  The one in libiberty returns 0.  Oh well.

We should probably change the one in libiberty anyhow.  They are
documented to return the same value that sprintf returns, but sprintf
will return 0 legitimately when called with an empty string.  Since 0
is a valid return value, we should use something else for an error
return value.  -1 is the obvious choice, particularly since that's
what glibc uses (and has used since 1991).

Ian



More information about the Binutils mailing list