Subject: Re: tales of woe from the recent tools/compat_defs.h pullups on
To: None <jmc@netbsd.org>
From: None <cgd@broadcom.com>
List: tech-toolchain
Date: 06/23/2004 09:15:37
At Wed, 23 Jun 2004 16:05:28 +0000 (UTC), "James Chacon" wrote:
> That's the common implementation as 
> 
> errno = 0;
> <some function call>
> <test errno value>
> 
> is common and perfectly valid, so threading models try hard not to completely
> break that mindset.  IIRC it's also the only way to be guarenteed
> of not possibly getting the wrong errno as I don't believe all functions are
> required to set errno to 0 if they didn't produce an error.

if people do that for function calls other than those that
specifically need it (because they don't directly return an error
indication), then they're broken.

AFAIK, errno being set is *not* necessarily an indication, for most
functions, that an error has occurred.

For most functions, the function has a return value that indicates
error, and only if that indicates an error should errno be checked.

(strtod et al., are one exception -- but even there, the notion of
what *might* be an error is well-defined.)



cgd