Implementation errors in strtol()

Giorgos Keramidas keramida at freebsd.org
Sun Jan 23 14:16:34 PST 2005


On 2005-01-24 00:16, Andrey Chernov <ache at nagual.pp.ru> wrote:
>On Sun, Jan 23, 2005 at 04:30:24PM +0200, Giorgos Keramidas wrote:
>> Why would checking for explicit errno values be necessary?  IIRC, after
>> a few emails I had exchanged with Dima Dorfman a few months ago,
>> checking for endptr *and* errno != 0 was ok.
>
> _Portable_ application must suppose that not all OSes are POSIX
> conformant, so it can't be sure what errno comes from strtol(), it is why
> explicit checking for known value is needed.

If errno is explicitly set (i.e. zeroed) by the calling program
immediately before strtol(), can we not be sure that it was, in fact,
strtol() that set it to any non-zero value?



More information about the freebsd-current mailing list