This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: errno.h: ESTRPIPE


Warren Young skrev:
> Peter Rosin wrote:
> > Consider code like this:
> > 
> > switch (errno) {
> > case -ESTRPIPE:
> > 	capers();
> > 	break;
> > case -EFOOBAR:
> > 	cucumber();
> > 	break;
> > }
> 
> The core assumption is that neither can happen.  Not now, not ever.
> 
> If that's true, the worst you can say against it is that gcc 
> will bitch 
> about the duplicate switch case.  If it's not true, that 
> kicks the legs 
> out from under the recommendation, so of course it shouldn't be done 
> that way.

Your core assumption doesn't matter. The worst I can say against it is
indeed that gcc will bitch about it, that was my whole point. gcc will
bitch about the above code regardless of the values cygwin will
assign to errno, as it's a compile time problem.

I should stress here that "gcc bitching" is in this case generating an
error and not finishing building whatever is being built.

Adding comptibility defines to help porting code should help porting,
and not require patching the package, that would just be silly.

> It would also be fine with me if the first "can't happen" value were 
> 9999, then the next 9998, etc.  I do like starting below 10000, as an 
> old Winsock hand.  Yes, I know, errno and WSAGetLastError() don't 
> overlap, but somehow it appeals to me to behave as if they could.

But that was not what I protested against. I don't care what numbers
are selected as long as they are unique.

Cheers,
Peter


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]