Implementation errors in strtol()
Andrey Chernov
ache at nagual.pp.ru
Fri Jan 21 14:12:01 PST 2005
On Fri, Jan 21, 2005 at 09:14:00PM +0100, Joerg Wunsch wrote:
> My point is: from a portability point of view, EINVAL is completely
> crap. You can as well drop it.
It simple means we can't rely on portability as the reason for or opposite
to this change.
> 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.
The code which _not_ expect this feature present is _equally_ unportable.
If we decide this change stay or not we can't rely on portability, all
things are equal there.
I repeat: portable application must always consider _both_ cases since
both are mentioned in the standard as possible ones. Portable application
can't stay with one variant only. Even if FreeBSD not implement "may"
clause, some other system can do it at any moment. Moreover, portable
application must consider non-POSIX conformant systems too, it additionly
complicates subject.
Since we can't rely on portability, we can rely on practical reason to
detect syntax errors which is hardly implemented by other methods (f.e.
method you suggest can't detect overflows). Of course, such applications
will be unportable per definition, but still POSIX conformant. We already
have a lot of such things in our own codebase.
BTW, where was you when this change was discussed and commited by first
time long ago? At those time I don't remember any "against" votes. All
those times passed and nobody complain until this moment. It is good sign
for this change to stay.
--
http://ache.pp.ru/
More information about the freebsd-current
mailing list