Skip to main content

Questions tagged [operators]

For questions about operators in programming languages. Operators are built-in tokens that perform specific operations on their operands distinct from functions.

18 votes
2 answers
4k views

In a lot of languages (eg Java, C++, etc), you can use ++ and -- as increment/decrement operators. What was the origin of ...
Otakuwu's user avatar
  • 725
34 votes
6 answers
6k views

I actually drafted most of this question before the relevant stack overflow question but it's still relevant. C has a famously confusing operator precedence order. It is divided into 15 levels and ...
mousetail's user avatar
  • 9,627
1 vote
2 answers
358 views

I wonder if anyone has tried implementing the decimal point as a binary operation a.b = $f(a, b) = a+b/10^{1+floor(log_{10} b)}$ That would simplify the PL design, and add new possibilities. For ...
Марат Рамазанов's user avatar
13 votes
2 answers
996 views

In C, most binary operators do not specify which operand will be evaluated first: ...
CPlus's user avatar
  • 10.5k
21 votes
6 answers
5k views

The typical syntax for accessing an array (or list, map and similar data structures) at a specific index is a[i]. I believe C first introduced it as syntax sugar, ...
linux_user36's user avatar
4 votes
2 answers
571 views

I am interested, is it possible that, in some programming language, two infix operators have the same priority, but different associativity? If so, how is that implemented in the parser?
FlatAssembler's user avatar
11 votes
4 answers
5k views

The most obvious way of supporting chained comparisons operators, such as a < b < c, is to rewrite it as ...
FlatAssembler's user avatar
2 votes
1 answer
759 views

One of the most confusing things to me about VHDL is that the <= operator can mean both "less than or equal to" and it can be a signal assignment ...
FlatAssembler's user avatar
10 votes
3 answers
2k views

In C, the relative precedence of bitwise operators is as follows, from high to low precedence: ...
WhiteMist's user avatar
  • 281
8 votes
6 answers
4k views

I just thought about the possibility for the less-than and-greater than operators to short-circuit. That is, they can skip evaluating their second operand if the value of the second operand logically ...
CPlus's user avatar
  • 10.5k
47 votes
6 answers
15k views

Having had very little math(s) education I'm trying to bring myself up to speed for university, which currently involves teaching myself the times tables, where X ...
Hashim Aziz's user avatar
3 votes
4 answers
440 views

In some C-based languages (including C/C++ themselves and Rust), taking pointers/references and dereferencing is done with prefix operators & and ...
abel1502's user avatar
  • 2,683
13 votes
5 answers
1k views

Say I have a loop that looks like this: for i in range(1, 10) { print(i) } Now I want to take the same sequence in reverse, and filter out even numbers. I might ...
Rob N's user avatar
  • 1,185
19 votes
3 answers
4k views

In MATLAB (and Octave), the \ (or mldivide) and \. operators are provided with the exact ...
Adám's user avatar
  • 3,317
18 votes
9 answers
6k views

Many languages have compound assignment statements, for example +=. However, for the common task of adding or subtracting 1 from a variable some languages (mostly ...
Seggan's user avatar
  • 3,412

15 30 50 per page