I wouldn't count strcmp, etc. It returns < 0 if str1 is shorter and > 0 if str1 is longer. Returning 0 means there is 0 difference. That's not a True/False.
"0" is not a "truthy" exit code for a system call, it rather denotes the absence of an error.
In my view, a value X being "truthy" means that `bool(X)` evaluates to TRUE, or `if(X)` gets executed.
In lambda calculus, true and false are conventionally represented as functions
lambda x. lambda y. x
and
lambda x. lambda y. y
so that "if b then x else y" is represented by "b x y".
When identifying booleans with bits, it seems natural to write this as "bit x_0 x_1" rather than "bit x_1 x_0" where the arguments seem to be in the wrong order.
This is one possible justification for identifying true with 0 and false with 1.
Okay, it's not insane, it just breaks from a convention followed by practically every programming language (and every logic / engineering / computing course) where integers can be interpreted as booleans. And that might be okay if there's a good reason, but the reasons given are pretty awful:
Ruby is one popular example of a language with a truthy zero. This is to allow the use of truthiness to detect the presence of a value (as long as the value isn't false), even if the value is zero. Say I wanted to allow an environment variable to override a value in my code. I could do something like this:
Dissimilarity for no good reason is, well, maybe not insanity but plain old dumb. Unless we're talking fashion not software projects, hence the "vanity" classification.
i don't really see why. if anything is insane, it's interpreting a number as true or false. but if you're doing that anyway, then you pick a number for false, or you pick a number for true. 0 is a natural number to pick for whichever truth value, because it's the base case of the natural numbers.
it's unconventional, but no more insane than 0 = false, which, again, _is_ insane, but conventional.
main() returns 0 for success, but I expect that is owed more to Unix.
A lot of (e.g. Linux) system calls return 0 for success and an error value on error, but again that's more down to Unix than C.