Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 14 Jun 2017 15:44:34 +0200
From: Florian Weimer <fweimer@...hat.com>
To: Xiaowei Zhan <zhanxw@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: Different behavior (strtod) between musl and glibc

Xiaowei Zhan <zhanxw@...il.com> writes:

> I notice that when pass a non-numeric char to strtod, musl will set
> errno to non-zero, but glibc will set errno to zero.  I am curious why
> this difference exists, and whether it is necessary to make strtod in
> musl behave similarly to glibc.

I think glibc leaves errno at zero; it does not set it.  For input which
cannot be converted, this seems to be the behavior mandated by C11.
POSIX describes the EINVAL value as an extension to the C standard.
glibc does not appear to implement this extension.

So both behaviors are correct.

Florian

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.