errno.h: ESTRPIPE

Warren Young warren@etr-usa.com
Fri Mar 13 21:14:00 GMT 2009


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.

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.



More information about the Cygwin-patches mailing list