Path: utzoo!utgpu!cunews!micor!latour!revcan!darren From: darren@revcan.UUCP (Darren Morbey) Newsgroups: comp.lang.c Subject: Re: The nonexistent operator (along = v. == lines) Summary: Clarification Keywords: xor Message-ID: <157@revcan.UUCP> Date: 3 Apr 91 15:35:32 GMT References: <156@revcan.UUCP> Organization: Revenue Canada, Taxation; Office Communications Division Lines: 20 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. ]