2 ms·
Why would an error code be negative?
by Raphael 15y ago
Why would an error code be negative?
- mc32 15y agoGood question. Labeling. Sometimes I get odd errors from crashed applications which read error code "-538", for example. Looking for error code 538 can lead to the error I was looking for but also for other 538s not equal to "-538".
- przemoc 15y agoIt's a matter of conventions. Look at Linux kernel for instance. Error codes are positive, but if function is returning error, then return code is -error, i.e. negative and it's pretty sensible solution. Mind that in case of syscalls, errno stuff comes from glibc, which wraps syscalls to set errno and return -1. So searching for -error is not something awkward, but, as stated earlier, you have to quote it in google to make it work.