www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Suggestion: Xor Comparison Operator

reply "Nick Sabalausky" <a a.a> writes:
Pretty much just as the subject says. It's rare and far from major, but I've 
come across a few places where it would be nice to be able to say "if(A ^^ 
B)" instead of "if(A && !B || !A && B)". 
Jul 03 2008
parent reply Gregor Richards <Richards codu.org> writes:
Nick Sabalausky wrote:
 Pretty much just as the subject says. It's rare and far from major, but I've 
 come across a few places where it would be nice to be able to say "if(A ^^ 
 B)" instead of "if(A && !B || !A && B)". 
 
 

!= is xor, genius. - Gregor Richards
Jul 03 2008
next sibling parent "Nick Sabalausky" <a a.a> writes:
"Gregor Richards" <Richards codu.org> wrote in message 
news:486DA24F.3090706 codu.org...
 Nick Sabalausky wrote:
 Pretty much just as the subject says. It's rare and far from major, but 
 I've come across a few places where it would be nice to be able to say 
 "if(A ^^ B)" instead of "if(A && !B || !A && B)".

!= is xor, genius. - Gregor Richards

Heh, oh yea :) if((x == 1) != (y != 2)) No reason for that not to work. Too tired today :)
Jul 03 2008
prev sibling parent superdan <super dan.org> writes:
Gregor Richards Wrote:

 Nick Sabalausky wrote:
 Pretty much just as the subject says. It's rare and far from major, but I've 
 come across a few places where it would be nice to be able to say "if(A ^^ 
 B)" instead of "if(A && !B || !A && B)". 
 
 

!= is xor, genius.

and <= is implication btw. but it does exhaustive evaluation unfortunately.
Jul 03 2008