4 ms·
I wish they had replaced the - operator since many error codes contain a minus and it's easier to type -2081 than "-2081".
by mc32 15y ago
I wish they had replaced the - operator since many error codes contain a minus and it's easier to type -2081 than "-2081".
- Raphael 15y agoWhy 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.
- Raphael 15y agoWhy would an error code be negative?