Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

my machine learning algorithm for predicting whether there are bugs in any of my team's code: (C code)

int main(int argc, char *argv[]) { return 1; }



Nonzero exit code means false (no bugs). If this program represents the entirety of your team's code, your story checks out.


it's true, non-zero exit code is supposed to mean boolean FALSE

but I am a part of my team, and so my code is my team's code, and hence the program is self-referential

I think?

my brain hurts


Amusing, but I feel like that's a terrible way to think about return codes. No error vs. error number does not map cleanly to a boolean.


Any other interpretation of his program goes against decades of Unix convention. http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.htm...


Ehhh, "if" is a bit of a specialized case. In general programs don't map fully to true/false, just leave it as "error code".

It's not that we should use any other interpretation, it's that that interpretation is only mostly true. Don't overgeneralize lest you introduce mistakes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: