Skip to main content

Questions tagged [operators]

Operators are symbols that occur in nearly all programming and coding languages, used for performing calculations, comparisons, and assignments of data. Use this tag for any questions relating to operators, in any language, including things such as syntax, behaviour and use.

44 votes
2 answers
3k views

What's the deal with all the different Perl 6 equality operators? (==, ===, eq, eqv, ~~, =:=, ...)

Perl 6 seems to have an explosion of equality operators. What is =:=? What's the difference between leg and cmp? Or eqv and ===? Does anyone have a good summary?
raldi's user avatar
  • 21.8k
3 votes
7 answers
6k views

Priority of C++ operators "&" and "->"

Given the following: &row->count Would &(row->count) be evaluated or (&row)->count be evaluated in C++? Here's a great link for C++ precedence.
stung's user avatar
  • 347
40 votes
8 answers
3k views

What does the comma operator do? [duplicate]

What does the following code do in C/C++? if (blah(), 5) { //do something }
Matt's user avatar
  • 2,224
1553 votes
11 answers
894k views

What are bitwise shift (bit-shift) operators and how do they work?

I've been attempting to learn C in my spare time, and other languages (C#, Java, etc.) have the same concept (and often the same operators)... At a core level, what does bit-shifting (<<, >&...
John Rudy's user avatar
  • 37.6k
5 votes
7 answers
3k views

PHP alias @ function

I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping(). What is it for? Googling / searching is not much of a help since @ gets discarded and '...
syaz's user avatar
  • 2,679
78 votes
19 answers
73k views

Suppress error with @ operator in PHP

In your opinion, is it ever valid to use the @ operator to suppress an error/warning in PHP whereas you may be handling the error? If so, in what circumstances would you use this? Code examples are ...
Mez's user avatar
  • 24.7k
74 votes
13 answers
199k views

How do I get a decimal value when using the division operator in Python?

For example, the standard division symbol '/' rounds to zero: >>> 4 / 100 0 However, I want it to return 0.04. What do I use?
Ray's user avatar
  • 191k
2 votes
11 answers
439 views

How to prevent creating intermediate objects in cascading operators?

I use a custom Matrix class in my application, and I frequently add multiple matrices: Matrix result = a + b + c + d; // a, b, c and d are also Matrices However, this creates an intermediate matrix ...
Ozgur Ozcitak's user avatar
1 vote
2 answers
199 views

Dynamically created operators

I created a program using dev-cpp and wxwidgets which solves a puzzle. The user must fill the operations blocks and the results blocks, and the program will solve it. I'm solving it using brute force, ...
Gero's user avatar
  • 1,842
9 votes
5 answers
5k views

Why Does Ruby Only Permit Certain Operator Overloading

In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded. This list may be incomplete but, here are some of the ...
Tony Pitale's user avatar
  • 1,192
1 vote
6 answers
636 views

relational operator expression order

This is probably a silly question, but curiosity has gotten the better of me. I've been seeing code lately that seems to "reverse" the order of expressions for relational operators e.g.: if (0 == ...
Adam Weber's user avatar
  • 2,395
578 votes
13 answers
388k views

How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?

What is the difference between == and ===? How exactly does the loosely == comparison work? How exactly does the strict === comparison work? What would be some useful examples?
nickf's user avatar
  • 543k
8 votes
5 answers
2k views

Haskell list difference operator in F#

Is there an equivalent operator to Haskell's list difference operator \\ in F#?
fryguybob's user avatar
  • 4,400
17 votes
3 answers
14k views

What is the operator precedence order in Visual Basic 6.0?

What is the operator precedence order in Visual Basic 6.0 (VB6)? In particular, for the logical operators.
Oskar's user avatar
  • 2,284
218 votes
9 answers
60k views

What does the comma operator , do?

What does the , operator do in C?
lillq's user avatar
  • 15.1k

15 30 50 per page