Newsgroups: comp.std.c Path: 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 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