Timeline for Make a big deal out of == true?
Current License: CC BY-SA 2.5
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 19, 2010 at 21:11 | comment | added | Christopher Galpin |
The name actionsAreAllowed asserts itself as a boolean, as you shouldn't find actionsAreAllowed = 5
|
|
Oct 19, 2010 at 11:00 | history | made wiki | Post Made Community Wiki | ||
Oct 19, 2010 at 10:28 | comment | added | Daniel Earwicker |
By writing if (x) { ... you are already asserting that x is a boolean or is convertible to a boolean. What you call it is irrelevant.
|
|
Oct 19, 2010 at 7:17 | comment | added | badp | @Cam did you hear that, it's the sound of a joke going right past you :P | |
Oct 19, 2010 at 4:35 | comment | added | Cam | @Graeme: Yes that would be optimal of course, which is why I agree with the OP and pretty much everyone else here on this point. | |
Oct 19, 2010 at 3:13 | comment | added | Graeme Perrow |
So rename the variable actionsAreAllowed .
|
|
Oct 19, 2010 at 3:08 | comment | added | Carl | if ( readable ) {} | |
Oct 19, 2010 at 2:02 | comment | added | johnc | bool isGoodThing = readibility?true:(codingStandards?true:(internalizationOfConcept?true:false)); | |
Oct 18, 2010 at 21:51 | comment | added | Cam | @SplashHit: But readability==goodthing is already obviously a boolean. So the extra true you're adding is actually reduntant. My argument is only for when the variable's type is in question. | |
Oct 18, 2010 at 20:42 | comment | added | JoelFan | if ((readability == GoodThing) == true) ... | |
Oct 18, 2010 at 20:18 | comment | added | Muad'Dib | readability == GoodThing | |
Oct 18, 2010 at 20:16 | history | answered | Cam | CC BY-SA 2.5 |