Skip to main content

Questions tagged [operators]

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

0 votes
1 answer
744 views

I have found another similar question, but the answer there talks mainly about C/C++, and does not mention about the division operator. So, in C/C++ and Java, dividing an integer by an integer returns ...
Arunabh's user avatar
1 vote
3 answers
483 views

Virtually all (imperative) languages offer the operators < <= >= > for lower, lower or equal, greater or equal and greater. But why no ternary range operator like (10 < x < 100) to ...
theking2's user avatar
  • 139
2 votes
3 answers
518 views

I had a debate with a work mate regarding the following code as to which one of it would be the better practice: My code (in pseudo): var A = <precondition either TRUE or FALSE>; var B; if(A) { ...
Chams's user avatar
  • 29
0 votes
1 answer
309 views

I don't know if this is the right place to ask more of a "philosophical" question. The more I code in Java, the more I have to bear with Comparable<T>. And the more I bear with this ...
Thomas Herondale's user avatar
0 votes
4 answers
287 views

I'm currently designing a database query language and I came to wonder what should be the best syntax for the comparison operator. Most modern languages use ==, but amongst the database languages ...
ibi0tux's user avatar
  • 241
18 votes
3 answers
2k views

I'm writing a wrapper for XML elements that allows a developer to easily parse attributes from the XML. The wrapper has no state other than the object being wrapped. I am considering the following ...
John Wu's user avatar
  • 27k
3 votes
1 answer
224 views

For example, say you have a class Point which has floating point components. It's tempting to overload the equality operator so you can do something like a = Point(1.1, 2.2) b = Point(3.3, 6.6) b /= ...
Josie Thompson's user avatar
6 votes
7 answers
4k views

When I was a beginner it took a while to learn the language syntax and the idea that languages couldn't improve after they were invented. But now we're seeing new language features added every year ...
1.21 gigawatts's user avatar
2 votes
1 answer
293 views

I would like to make a simple web application (a static website where all computation happens on the client) that generates a mesh and displays it. I have a working prototype in Unity and now I'm ...
Toast's user avatar
  • 128
1 vote
2 answers
1k views

I recently had a discussion with a friend about code maintainability with regards to modifying an iterator inside of the body of a loop (C# syntax): List<int> test = new List<int>(); for (...
Taco's user avatar
  • 1,175
0 votes
2 answers
1k views

As far as I have been able to find, the first language to use ^ for exponentiation was BASIC, in 1964. Earlier languages, such as Fortran, used other symbols such as ** for exponentiation (although in ...
CoffeeTableEspresso's user avatar
3 votes
1 answer
121 views

For example, to convert between g and kg, I have a constant 1000: public static final float G_TO_KG=1000; . . . this.result = someResult*1000; I found G_TO_KG always bind to operator '*'. So my ...
ocomfd's user avatar
  • 5,760
2 votes
4 answers
4k views

Both the comma operator and the semicolon can be used to separate statements. Let's consider this simple code: #include <stdio.h> void do_something(int*i) {(*i)++;} int main() { int i; ...
gaazkam's user avatar
  • 4,529
58 votes
8 answers
20k views

Is there an operator equivalent of nor? For example, my favorite color is neither green nor blue. And the code would be equivalent to: // example one if (color!="green" && color!="blue") { ...
1.21 gigawatts's user avatar
62 votes
3 answers
11k views

I am a bit confused by the MSDN C# documentation which states that & and | are logical operators and that && and || are conditional operators. I keep calling &&, || and ! logical ...
John V's user avatar
  • 4,946

15 30 50 per page
1
2 3 4 5 6