Article View: comp.std.c
Article #1687Re: Why no logical XOR operator
From: Henry Spencer
Date: Thu, 13 Sep 1990 15:54
Date: Thu, 13 Sep 1990 15:54
15 lines
1030 bytes
1030 bytes
In article <1990Sep12.154515.18460@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes: > if (x ^^ (y & z)) > >If there was such a thing as a '^^' operator. Does anyone know why C left >out the logical XOR operator? Try `!x != !(y & z)', which gets the same results; if the operands are booleans to begin with, you can leave out the unary !s. "^^" is a perennial suggestion which really has very little to recommend it. It can't short-circuit like && and ||, because XOR has to evaluate both operands. And it would be useful rather rarely. -- TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology OSI: handling yesterday's loads someday| henry@zoo.toronto.edu utzoo!henry
Technical Details
Message-ID:
<1990Sep13.155424.19104@zoo.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!henryReferences:
<1990Sep12.154515.18460@druid.uucp>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Why no logical XOR operator Message-ID: <1990Sep13.155424.19104@zoo.toronto.edu> Organization: U of Toronto Zoology References: <1990Sep12.154515.18460@druid.uucp> Date: Thu, 13 Sep 90 15:54:24 GMT