What does the || operator do?
Attacklab.wmd_env.buttons=Attacklab.wmd_env.buttons||_4;

what does the || do in this case?
Adds _4 to the array which is Attacklab.wmd_env.buttons?

Score: 7
Tags: javascript, operators
Views: 2387
Date posted: 5/6/2009

What does the "=!" operator do?

I accidentally typed =! instead of != that caused a huge bug in a system that went undetected for a while; I have fixed it since but I'm curious as to what =! does.

I had something like this

void foo(int param)
{
    int a = 0;

    ... 

    if (a =! param)
    {
        // never got here even when `a` was not equal to `param`  
    }
    ...
}

Can someone explain what the above if statement is evaluating ?

Score: 6
Tags: c++, c, operators
Views: 2631
Date posted: 1/9/2013

What does the ?? operator do?

Possible Duplicate:
What is the “??” operator for?

I have recently come across the ?? operator in C#. What does this operator do and when would someone use it?

Example:

string name = nameVariable ?? string.Empty;
Score: 5
Tags: c#
Views: 925
Date posted: 8/4/2010

What does the %= operator do?

What does the %= operator do, as shown in this example:

if (a > b)
   a %= b;

What are its uses and is it commonly used?

Score: 5
Tags: c#
Views: 14932
Date posted: 9/29/2013

What does the &^ operator do?

According to the specification this operator is called bit clear:

&^   bit clear (AND NOT)    integers

I've never heard of such an operator before, and I'm wondering why is it useful.

It seems to take the left operand and disables all the bits that are turned on in the right operand. Is there any formal description of the operator? One more thing I noticed is that it's not commutative. Pseudocode in comarison with ^:

11110 &^ 100 //11010
11110  ^ 100 //11010

11110 &^ 0 //11110
11110  ^ 0 //11110

11110 &^ 11110 //0
11110  ^ 11110 //0

11110 &^ 111 //11000
11110  ^ 111 //11001

111 &^ 11110 //1
111  ^ 11110 //11001
Score: 5
Tags: go, bit-manipulation
Views: 153
Date posted: 6/1/2014


2


© 2021 Search Overflow
Contributions licensed under cc by-sa