Compound bitwise XOR fails silently

Sketch:

void setup() { Serial.begin(9600); byte x=0; Serial.println("before:"); Serial.print(x); Serial.println(); x^=0; Serial.println("after:"); Serial.print(x); Serial.println(); } void loop() {

}

Output:

before: 0 after:

0

What is wrong with that, apart from the fact that you don't know How to post code properly

Pete

x^=0;

a number xor’ed with 0 is just the number.
a number xor’ed with all 1s is the bitwise inversion of the number.
a number xor’ed with itself is always 0.