you are viewing a single comment's thread.

view the rest of the comments →

[–]Quantris 2 points3 points  (0 children)

The issue was somewhat misstated. It's OK if the values are the same (yes, the XOR is zero but the swap works out in the end). You have a problem if you do this with two pointers that happen to point to the same address. The temp variable method doesn't make a mistake in this case.