Let me be blunt, in turn.
You. are. a. fucking. spastic.
At no point have I argued that C error codes are, or should be, considered boolean. Indeed, my post above doesn't even make sense in that respect, because the return value of (for example) fopen() is not an error code, but
@POSIX said:Upon successful completion, fopen() shall return a pointer to the object controlling the stream. Otherwise, a null pointer shall be returned, and errno shall be set to indicate the error.
There you go. Most core functions, due in part C's lousy type system, have to put an error code in the global value errno and somehow flag that the they have done so by returning a nonsense value.
However...
@powerlord said:A program can return any non-zero number it wants for the error code.
I bet you'd like to tell me why I've emphasised the "non-zero number" bit. Could it possibly be that, as C has no notion of boolean types, the following code works?
[code]
if (errno) {
/* error handling */
}
[/code]
Why yes, it could.
You mong.