Re: undefined references since newlib-3.2.0

Josef Wolf <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Sat, Jun 13, 2020 at 10:20:54AM -0700, Keith Packard wrote:

> Here are some affected libc functions which don't return a pointer and
> which have no error indication of any kind:
> 
>         atof
>         atoff
> [ ... ]
>         strtod
>         strtof
>         strtold
>         wcstod
>         wcstold
>         strtodg

Uh! Why on earth would those functions need to allocate memory?

> These now return infinity and set errno to ERANGE on allocation
> failure. (not ideal, but the options are limited)
> 
> Here are some which do return a pointer, but do not document any errors:
> 
>         ecvt
>         fcvt

Maybe the documentation can be fixed?

>         gcvt
>         ecvtbuf
>         fcvtbuf
>         gcvtbuf

Those get a pointer passed. No need to allocate memory.

> And here's a list of functions which I feel reasonable applications
> should not expect an allocation error from:

I don't think any application should expect those functions to call exit()
and/or abort() either.

>         sprintf
>         snprintf

Those should return -1 on failure.

>         sscanf

For this, ENOMEM is documented.

-- 
Josef Wolf
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.