-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Bruno Haible on 1/24/2009 6:34 AM: > >>> + - In case of other error, return 0 and set errno, for example to EINVAL >>> + or ENOMEM. */ >> I think that POSIX is explicit that the only way to fail strtod() with >> EINVAL is if nothing was parsed > > No, other reasons are allowed as well. See > <http://www.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_03> > "Implementations may support additional errors not included in this list, > may generate errors included in this list under circumstances other than > those described here, or ..."
Finish reading that paragraph: "...if and only if all those error conditions can always be treated identically to the error conditions as described in this volume of POSIX.1-2008. Implementations shall not generate a different error number from one required by this volume of POSIX.1-2008 for an error condition described in this volume of POSIX.1-2008, but may generate additional errors unless explicitly disallowed for a particular function." ENOMEM is an additional error not mentioned in POSIX, but for which the semantics of the error make sense. But returning EINVAL for any reason other than an invalid parse where *endptr == nptr, is a condition of returning an error specified by POSIX but for a different reason than allowed by POSIX. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkl7GdUACgkQ84KuGfSFAYA1ggCfXTV2NA7AUXU0sBcS2Bd92pkS wyQAnjwfd+8leXOgKSoSahX6H6ycvSLK =fTa3 -----END PGP SIGNATURE-----