Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!btr!mips!ultra!jerbil From: jerbil@ultra.com (Joseph Beckenbach {Adapter Software Release Engr}) Newsgroups: comp.lang.c Subject: Re: Portable XOR Message-ID: <1991Apr19.162526.6742@ultra.com> Date: 19 Apr 91 16:25:26 GMT References: <157@revcan.UUCP> <1991Apr18.161333.3463@ultra.com> Organization: Ultra Network Technologies Lines: 22 Following up my own article here, and apologies for missed names: > In <157@revcan.UUCP> darren@revcan.UUCP (Darren Morbey) writes, >asking for a macro returning XOR of its arguments, evaluating once and >only once. I've not worked out a more elegant solution for my toolbag, ... but I've had a light flurry of mail with comments, including one from the Netherlands pointing out that XOR(a,XOR(b,c)) would fail using my implementation. Serves me right for reusing old code without doing a double-check of other things! :-) Another sent me the macro #define XOR(o,_) ((o)?!(_):(_)) which "does the right thing". Another macro for toolbox.h :-) Joseph Beckenbach journeyman programmer (still working towards craftsman status) -- Joseph Beckenbach jerbil@ultra.com VEGGIES FOREVER! work 408-922-0100 x246