The conditions tag has no wiki summary.
53
votes
34answers
7k views
Is the ternary operator evil? [closed]
For example, would you prefer this one-liner
int median(int a, int b, int c)
{
return (a<b) ? (b<c) ? b : (a<c) ? c : a : (a<c) ? a : (b<c) ? c : b;
}
or an if/else solution ...
29
votes
10answers
3k views
Why do we have to use break in switch
Who decided, and basing on what concepts, that switch construction (in many languages) has to be, like it is? Why do we have to use break in each statement? Why do we have to write something like ...
8
votes
4answers
631 views
Is the use of explicit ' == true' comparison always bad? [duplicate]
Possible Duplicate:
Make a big deal out of == true?
I've been looking at a lot of code samples recently, and I keep noticing the use of...
if( expression == true )
// do something...
...