Regarding programming languages, operators are constructs which behave generally like functions, but which differ syntactically or semantically from usual functions. From Wikipedia: http://en.wikipedia.org/wiki/Operator_%28programming%29
18
votes
15answers
2k views
What are bit operators good for? [closed]
Programming languages often come with various bit operators (e.g. bitwise left- and right shift, bitwise AND, OR, XOR...). These don't get used though very much, or at least such has my experience ...
58
votes
33answers
12k views
Ternary operator considered harmful? [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 ...
3
votes
3answers
449 views
Specifics of Switch and If statements
Why do we need the switch statement if there is the if statement? Why can't we use several ifs like
if(a==1) do this1;
if(a==2) do this2;
...
instead of
switch (a) {
case(1): {do ...
2
votes
1answer
203 views
Languages supporting unicode logic operators
Are there any programming languages that support the use of unicode logic operators? For example, many programming languages use "!=" as the "does not equal"
operator, but in mathematics the symbol ...
6
votes
3answers
587 views
How useful are infix operators in a programming language?
How useful are infix operators in a programming language? Are they worth the extra complexity they provide? Can you provide any examples where infix operators are better suited to the problem that ...