3 ms·
The article is wrong though. For error codes, 0 being a success value is the CONVENTION. A non-zero code is an error. This isn't about "programming languages."
by banachtarski 7y ago
The article is wrong though. For error codes, 0 being a success value is the CONVENTION. A non-zero code is an error. This isn't about "programming languages."
- gbacon 7y agoWrong is a bit harsh for a convention or semantics, more like imprecisely worded.
- SAI_Peregrinus 7y agoThe problem is that for bash `true` is a function (or builtin) that returns 0, while for C (and thus most languages) any non-zero value (typically 1 for the builtins) is true. In c99 and later with stdbool.h, `true` is almost always defined as `#define true 1`.
- aidenn0 7y agothe existence of the && and || operators (not to mention the true and false utilities) would indicate it's more than just a convention.