Hacker News new | ask | show | jobs
by jstanley 1725 days ago
strcmp,memcmp,etc. return 0 for equality, maybe you'd count that? But it's not really indicating "true", more "no difference".

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.

1 comments

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.