Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!topaz!ll-xn!cit-vax!nike!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: Orphaned Response Message-ID: <86900011@haddock> Date: Fri, 15-Aug-86 16:44:00 EDT Article-I.D.: haddock.86900011 Posted: Fri Aug 15 16:44:00 1986 Date-Received: Sun, 17-Aug-86 07:29:25 EDT References: <518@hadron.UUCP> Lines: 22 Nf-ID: #R:hadron.UUCP:518:haddock:86900011:000:1224 Nf-From: haddock!karl Aug 15 16:44:00 1986 mmintl!franka (Frank Adams) writes: [re the expression e1?e2:e3 where e2 and e3 are void] >It seems to me that there are two different paradigms for how to interpret >the ?: operator here. One is as an ordinary operator, which returns one of >the values of e2 or e3, depending on the value of e1. Under this >interpretation, it does not seem to me appropriate to permit e2 and e3 void, >since in that case they have no values. > >The other paradigm is that e1?e2:e3 is precisely one of e2 or e3 ... This >is a very reasonable interpretation; but [then it should preserve lvalues]. >In particular, one could write "e1?e2:e3 = e4;". I see your point. I think both voids and lvalues should be allowed, though the argument for the latter is less obvious. I've had a few occasions where I wanted to use a conditional lvalue, and had to settle for an if-else and a temporary variable (for e4). "*(e1?&e2:&e3) = e4;" doesn't work if one of e2 or e3 is a register or a bit-field, and it looks uglier. (Also, it tends to compile into "temp = e1 ? &e2 : &e3; *temp = e4;" rather than "temp = e4; e1 ? e2 = temp : e3 = temp;", at least on the machines I've tested.) Karl W. Z. Heuer (ihnp4!ima!haddock!karl), The Walking Lint