The nonexistent operator (along = v. == lines)

Darren Morbey darren at revcan.UUCP
Thu Apr 4 01:35:32 AEST 1991


Based on some of the responses I've gotten so far, I should
clarify what I would like when I say ^^.  I do realize that there
is no "short-circuit" evaluation (a term used repeatedly) for the
Boolean xor as there is for && and ||; I didn't realize that
short-circuit evaluation was the standard.

What I did require was an operator, macro, or function that treated
its operands as "zero" or "non-zero" as && and || do rather than
the bitwise & | ^.  I also would like some guarantee that both
operands were evaluated *once* *and* *only* *once* (O&OO).  Based
on that, I do recognize that in
  1.    #define XOR(a,b) ( ( !(a) && (b) ) || ( (a) && !(b) ) )
I cannot guarantee that a is evaluated O&OO every time.

As I mentioned, I would like to be as portable as possible, so
please be careful.

[ Darren Morby     +1 613 957 9281     {uunet|lsuc|fts1}!revcan!darren ]
[ Revenue Canada Taxation, 3052-400 Cumberland St, Ottawa,ONT  K1A 0L8 ]
[                            "The challenge... is yours."  Dick Clark. ]



More information about the Comp.lang.c mailing list