Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!princeton!allegra!ulysses!bellcore!whuxcc!lcuxlm!akgua!mcnc!ncsu!uvacs!edison!steinmetz!davidsen From: davidsen@steinmetz.UUCP (Davidsen) Newsgroups: net.lang.c,net.bugs Subject: Re: e1?(void_e2):(void_e3) Message-ID: <895@kbsvax.steinmetz.UUCP> Date: Fri, 15-Aug-86 12:12:07 EDT Article-I.D.: kbsvax.895 Posted: Fri Aug 15 12:12:07 1986 Date-Received: Sun, 17-Aug-86 09:12:48 EDT References: <273@watmath.UUCP> <5858@alice.uUCp> <134@sas.UUCP> <155@cbnap.UUCP> <499@dg_rtp.UUCP> <1701@mmintl.UUCP> Reply-To: davidsen@kbsvax.UUCP (Davidsen) Organization: General Electric CRD, Schenectady, NY Lines: 33 Xref: watmath net.lang.c:10266 net.bugs:875 In article <1701@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes: >The other paradigm is that e1?e2:e3 is precisely one of e2 or e3, depending >on the value of e1. This is a very reasonable interpretation; but if it >were correct, there would be one other important consequence which is not in >fact legal. This is that when e2 and e3 are lvalues, the compound >expression should also be an lvalue. In particular, one could write > >e1?e2:e3 = e4; > >which would mean the same thing as > >if (e1) then e2 = e4; else e3 = e4; > This kicked off an interesting thought: *(e1 ? : ) = expr; Lo and behold it does what the quoted expression indicates. In an actual example: *(a < b : &b : &a) = 70; I'm not sure it *good* for anything, but if I do it with macros using cute names, I can enter it in the obfuscated C contest... -- -bill davidsen ihnp4!seismo!rochester!steinmetz!--\ \ unirot ------------->---> crdos1!davidsen chinet ------/ sixhub ---------------------/ (davidsen@ge-crd.ARPA) "Stupidity, like virtue, is its own reward"