Timeline for Make a big deal out of == true?
Current License: CC BY-SA 2.5
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 20, 2010 at 20:02 | comment | added | jkerian | Just note that I have seen a few cases of if(x) x=true; which were NOT redundant, but rather the equivalent of x=!!x; (normalizing x to 0/1) | |
| Oct 20, 2010 at 19:26 | comment | added | Anthony Pegram | Oh boy, the art of thinking. I literally came across this in our codebase last week. if (!someCondition) { someCondition = false; } I've seen some (er, many) redundancies as well as some impossibilities in our code, but this one was so simple yet so aggravating to think that somebody actually wrote it. Multiple times, even. | |
| Oct 19, 2010 at 11:54 | comment | added | Lie Ryan | Sometimes I would write if (c == true) return true; else return false;, but 99% of the time (the 1% is there since I can never be sure that I didn't miss some) I'll immediately notice and replace the whole thing with return c. I'll expect most competent programmers should do something similar if they developed the habit early on their career. What I wouldn't expect is a wtf response. | |
| Oct 19, 2010 at 11:00 | history | made wiki | Post Made Community Wiki | ||
| Oct 19, 2010 at 3:52 | comment | added | yawmark | Agree wholeheartedly about evaluation. On occassion I've wondered, "Where does it stop?" if ((((x == true) == true) == true) != false) // and so on... | |
| Oct 18, 2010 at 23:18 | comment | added | dash-tom-bang | I wouldn't so quickly chalk this up to habit. I've heard some truly stunning things out of professional programmers' mouths. Usually followed shortly thereafter by one of the grokkers, "how did this ever work?" | |
| Oct 18, 2010 at 20:29 | history | answered | Tim Goodman | CC BY-SA 2.5 |