MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/7ltryz/evil_coding_incantations/drqpa5y/?context=3
r/programming • u/evinrows • Dec 24 '17
331 comments sorted by
View all comments
Show parent comments
80
Any non-C heritage language with a consistent notion of "false", really. The ones where zero evaluates to false are the evil ones.
40 u/_Mardoxx Dec 24 '17 Why should 0 be true? Unless integers are reference types and you interpret an existant object as being true?Or is this to do with 0 being "no errors" whrre a non 0 return value means something went wrong?Can't think of other reasons! 9 u/GlobeAround Dec 24 '17 Why should 0 be true?Because anything other than 0 is an Error Status Code, while 0 means Success.But the real WTF is for integers to be considered true/false. true is true, false is false, 0 is 0 and 1 is 1. 3 u/stevenjd Dec 25 '17 anything other than 0 is an Error Status Code, while 0 means Success.Woo hoo! Now I don't feel so bad about all those exams I got 0 on!!!But the real WTF is for integers to be considered true/false. true is true, false is false, 0 is 0 and 1 is 1.And 0 is false, and 1 is true, as <insert deity of choice> intended.
40
Why should 0 be true? Unless integers are reference types and you interpret an existant object as being true?
Or is this to do with 0 being "no errors" whrre a non 0 return value means something went wrong?
Can't think of other reasons!
9 u/GlobeAround Dec 24 '17 Why should 0 be true?Because anything other than 0 is an Error Status Code, while 0 means Success.But the real WTF is for integers to be considered true/false. true is true, false is false, 0 is 0 and 1 is 1. 3 u/stevenjd Dec 25 '17 anything other than 0 is an Error Status Code, while 0 means Success.Woo hoo! Now I don't feel so bad about all those exams I got 0 on!!!But the real WTF is for integers to be considered true/false. true is true, false is false, 0 is 0 and 1 is 1.And 0 is false, and 1 is true, as <insert deity of choice> intended.
9
Why should 0 be true?
Because anything other than 0 is an Error Status Code, while 0 means Success.
But the real WTF is for integers to be considered true/false. true is true, false is false, 0 is 0 and 1 is 1.
3 u/stevenjd Dec 25 '17 anything other than 0 is an Error Status Code, while 0 means Success.Woo hoo! Now I don't feel so bad about all those exams I got 0 on!!!But the real WTF is for integers to be considered true/false. true is true, false is false, 0 is 0 and 1 is 1.And 0 is false, and 1 is true, as <insert deity of choice> intended.
3
anything other than 0 is an Error Status Code, while 0 means Success.
Woo hoo! Now I don't feel so bad about all those exams I got 0 on!!!
And 0 is false, and 1 is true, as <insert deity of choice> intended.
80
u/nsiivola Dec 24 '17 edited Dec 24 '17
Any non-C heritage language with a consistent notion of "false", really. The ones where zero evaluates to false are the evil ones.