Article View: comp.std.c
Article #1690Re: Why no logical XOR operator
From: Doug Gwyn
Date: Thu, 13 Sep 1990 18:07
Date: Thu, 13 Sep 1990 18:07
16 lines
1170 bytes
1170 bytes
In article <1990Sep12.154515.18460@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes: >Does anyone know why C left out the logical XOR operator? The C standard left it out because it hasn't been part of C, and it wouldn't address a severe deficiency, which was the only valid reason for adding functionality during standardization. The reason that C hasn't had a "logical exclusive-or operator" is that it would serve no real purpose. The reason for specific "logical and" and "logical or" operators is to obtain the short- circuit effect; obviously a "logical exclusive-or" would not be able to short-circuit. If you really feel like you need one, you can define your own: #define XOR(a,b) (((a)!=0 ^ (b)!=0) & 1) /* for example */
Technical Details
Message-ID:
<13843@smoke.BRL.MIL>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwynReferences:
<1990Sep12.154515.18460@druid.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Why no logical XOR operator Message-ID: <13843@smoke.BRL.MIL> Date: 13 Sep 90 18:07:41 GMT References: <1990Sep12.154515.18460@druid.uucp> Followup-To: comp.lang.c Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 16