Re: Implementation errors in strtol()

From: Joerg Wunsch <freebsd-current_at_uriah.heep.sax.de>
Date: Fri, 21 Jan 2005 21:14:00 +0100
As Andrey Chernov wrote:

> > Btw., Solaris never sets errno to EINVAL except for the
> > unacceptable base case (where SUSP requires it).

> This is _recent_ "Extension to the ISO C standard" as POSIX/SUSv3
> names it. No wonder that some systems with old code base not
> implement it yet.

Solaris is anything else but an ``old code base'', and it's not all
that recent, as SUSPv2 is many years old.

> Also see about "may" words tendency at the end of the message.

Sure, that's why I think the entire EINVAL issue is quite pointless.
As long as an application ``may'' support it, there's no guarantee
about it, thus a conformant application cannot rely on it, and is
forced to have their own validity checks.  This defeats the entire
idea behind setting errno to EINVAL completely.  (This is made even
worse in that many systems simply quote the SUSP man page as their
system's man page, including the `may', so you cannot even be sure
about their particular behaviour by reading their docs.  This applies
to both, Linux and Solaris.)

> Portability is another subject there. From portability point of view
> there is no difference, ...

My point is: from a portability point of view, EINVAL is completely
crap.  You can as well drop it.

> There is tendence in POSIX standards showing for years. What is
> "may" in first edition becomes "must" after few years. IMHO it will
> be better to keep the system already prepared.

I still disagree.  This hasn't been changed over years, as the line
from Posix to SUSPv2 through SUSPv3 shows.  Well, according to Bruce
it's even been just the opposite in the first Posix drafts, where
EINVAL was required for conversion errors and optional for bad values
of base, so you could infer that they are phasing the feature out
instead of in. ;-)

Do whatever you want, I think it's silly and should rather be dropped
as it is a useless feature, which could only lead people to write
unportable code.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
Received on Fri Jan 21 2005 - 19:20:08 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:26 UTC