Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ncoast.UUCP Path: utzoo!linus!decvax!cwruecmp!atvax!ncoast!bsa From: bsa@ncoast.UUCP (Brandon Allbery) Newsgroups: net.lang.c Subject: Re: Standard extensions (logical exclusive or) Message-ID: <480@ncoast.UUCP> Date: Sat, 10-Nov-84 11:19:11 EST Article-I.D.: ncoast.480 Posted: Sat Nov 10 11:19:11 1984 Date-Received: Tue, 13-Nov-84 06:51:37 EST References: <374@petsd.UUCP> <3081@alice.UUCP> Reply-To: bsa@ncoast.UUCP (Brandon Allbery) Organization: North Coast XENIX, Cleveland Lines: 35 Summary: > Article <3081@alice.UUCP>, from ark@alice.UUCP (Andrew Koenig) +---------------- | Joseph Orost suggests a new operator ^^ such that | a^^b | would be equivalent to | a? (b?0:1): (b?1:0) | | What is wrong with writing | a!=b | for this purpose? C programmers like to cut corners; witness all those on1 messages that depend on && evaluating as little as possible. It may be in K&R, but I've seen too many harebrained implementations of too manu programs... The problem with a!=b is that some of us use other corner-cutters: one of mine is if (index("AIJKLRaijklr", cmdchr)) dothis(); where index (strchr for USGers) returns either NULL or a pointer. This will NOT work if you use != for an xor: if (iscmd!=index("AIJKLRaijklr", cmdchr)) dothis(); is only true if !iscmd and !index(...), since index will usually NOT return a 1... --bsa -- Brandon Allbery @ North Coast Xenix | the.world!ucbvax!decvax!cwruecmp! 6504 Chestnut Road, Independence, Ohio | {atvax!}ncoast!{tdi1!}bsa (216) 524-1416 \ 44131 | E1439@CSUOHIO.BITNET (friend's acct.) ---------------------------------------+--------------------------------------- `Confusion is my natural state.'