[Issue 3481] PATCH: opPow(), x ^^ y as a power operator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 8 06:55:49 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3481



--- Comment #7 from Stewart Gordon <smjg at iname.com> 2009-11-08 06:55:47 PST ---
(In reply to comment #6)
> Logical xor is already in the language, its symbol is !=.

Not quite.  For example, 1 != 2 evaluates to true, whereas if ^^ is defined as
a logical xor, 1 ^^ 2 would evaluate to false.

But if the operands are guaranteed to be boolean or at least 0 or 1, then != is
effectively a logical xor.  To get logical xor when other values are possible,
one would have to do something like negate the operands.

So essentially, a ^^ b would be equivalent to !a != !b.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list