[haiku-development] Re: POSIX error code

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 21 May 2008 10:26:09 +0200

Ingo Weinhold wrote:
> 
> On 2008-05-21 at 01:05:51 [+0200], kaoutsis <kaoutsis@xxxxxx> wrote:
> > Ingo Weinhold wrote:
> > > wrote:
> > > Anyway, it certainly doesn't harm to try, but I have little hope that 
> > > this will have any effect. If the standard maintainers consider the 
> > > request, they are in a dilemma. Undoing the Issue 6 error codes 
> > > change means that all the applications that relied on it would become 
> > > non-conforming.
> > >
> > >   
> > I agree.
> > I had an idea how to tackle the problem, may be good, may be bad:
> 
> The main problem is not binary compatibility. The problem is that the Be 
> API requires that error codes be negative. E.g. create_sem() returns a 
> non-negative value (the sem_id) when successful, a negative error code 
> otherwise. A good deal of other functions/methods use the same strategy, 
> and so does third party code. Making our error codes positive will break 
> them all.
> 
> Changing concerned API functions to return -1 and set errno would be an 
> option, but that would be quite a bit of work and third party software 
> would have to be changed as well. Personally I don't even find this 
> option very appealing.

To be honest, I don't like that either. Checking error codes happens 
virtually all over the place, at least in code I have written. That would 
be a major pain to change. I don't find the errno thing more elegant 
either, maybe I am missing something though.

Best regards,
-Stephan

Other related posts: