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


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.


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