Subject: Re: tales of woe from the recent tools/compat_defs.h pullups on netbsd-1-6
To: None <>
From: James Chacon <>
List: tech-toolchain
Date: 06/23/2004 11:41:52
On Wed, Jun 23, 2004 at 09:15:37AM -0700, wrote:
> 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.

Yes. I was assuming you don't check unless return == -1 or some other 
documented way the function says "I got an error".

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

As long as it is clear how to detect it.