Hi Bruno,
On Fri, Jul 19, 2024 at 06:54:40PM GMT, Bruno Haible wrote:
> Alejandro Colomar wrote:
> > strtod(3) defers to strtol(3) for the example program.
>
> Is this adequate? strtod() can produce underflow (e.g. for "1e-500").
> In this case all implementations except MSVC set errno to ERANGE.
Alejandro Colomar wrote:
> We'd need to know the precise specification of that system that can set
> errno = ENOMEM.
>
> Is *endp guaranteed to be set? Or may it be unset (as happens with
> EINVAL)?
One system that calls malloc() during strtod() is NetBSD. See
$ grep -ri malloc src/lib/libc/gdt
Alejandro Colomar wrote:
> strtod(3) defers to strtol(3) for the example program.
Is this adequate? strtod() can produce underflow (e.g. for "1e-500").
In this case all implementations except MSVC set errno to ERANGE.
This is a case that cannot happen in strtol().
Bruno
Stop tagging me in your submissions. I have no involvement in any of this
activity.
--
Andrew J. Hesford
a...@sideband.org
[Mobile communication]
> On Jul 18, 2024, at 5:25 PM, Alejandro Colomar wrote:
>
> On Thu, Jul 18, 2024 at 11:09:40PM GMT, Bruno Haible wrote:
>> Hi Alejandro,
>
> Hi Br
On Fri, Jul 19, 2024 at 12:14:19AM GMT, Alejandro Colomar wrote:
> [CC -= Andrew, per explicit request]
>
> On Thu, Jul 18, 2024 at 11:25:11PM GMT, Alejandro Colomar wrote:
> > On Thu, Jul 18, 2024 at 11:09:40PM GMT, Bruno Haible wrote:
> > > Hi Alejandro,
>
> Hi Bruno,
>
> > > > strtol(3) has a
Hi Bruno,
On Fri, Jul 19, 2024 at 12:34:39AM GMT, Bruno Haible wrote:
> Alejandro Colomar wrote:
> > > - Some systems return "wrong" errno values. Example: [1]
> > > - Some systems fail with ENOMEM when memory is tight. Who says that
> > > an implementation of strtol() cannot use malloc()
Alejandro Colomar wrote:
> > - Some systems return "wrong" errno values. Example: [1]
> > - Some systems fail with ENOMEM when memory is tight. Who says that
> > an implementation of strtol() cannot use malloc() ? Some implementations
> > of strtod() do use malloc().
> >
> > So, what y
[CC -= Andrew, per explicit request]
On Thu, Jul 18, 2024 at 11:25:11PM GMT, Alejandro Colomar wrote:
> On Thu, Jul 18, 2024 at 11:09:40PM GMT, Bruno Haible wrote:
> > Hi Alejandro,
Hi Bruno,
> > > strtol(3) has a limited set of possible states:
> > > ...
> > > The condition '*endp != s && errno
On Thu, Jul 18, 2024 at 11:09:40PM GMT, Bruno Haible wrote:
> Hi Alejandro,
Hi Bruno,
> > strtol(3) has a limited set of possible states:
> > ...
> > The condition '*endp != s && errno != 0 && errno != ERANGE' is
> > unreachable. The only errno possible if '*endp != s' is ERANGE.
>
> Such a sta
Hi Alejandro,
> strtol(3) has a limited set of possible states:
> ...
> The condition '*endp != s && errno != 0 && errno != ERANGE' is
> unreachable. The only errno possible if '*endp != s' is ERANGE.
Such a statement can be true if you look at the standards (ISO C, POSIX).
However, there's a d
10 matches
Mail list logo