Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!topaz!ll-xn!mit-amt!mit-eddie!genrad!decvax!decwrl!amdcad!amdimage!prls!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP Newsgroups: net.lang.c,net.bugs Subject: Re: e1?(void_e2):(void_e3) Message-ID: <1701@mmintl.UUCP> Date: Thu, 7-Aug-86 11:13:56 EDT Article-I.D.: mmintl.1701 Posted: Thu Aug 7 11:13:56 1986 Date-Received: Tue, 12-Aug-86 15:06:21 EDT References: <273@watmath.UUCP> <5858@alice.uUCp> <134@sas.UUCP> <155@cbnap.UUCP> <499@dg_rtp.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT Lines: 31 Xref: mnetor net.lang.c:5600 net.bugs:315 [Not food] It seems clear that according to the ANSI draft, e1?e2:e3 is legal when e2 and e3 are both void. The next question is, should it be? 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, 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 would be permitted only if e2 and e3 had exactly the same type, of course; one could not do this if e2 was a short and e3 a long.) This seems to me like a reasonable extension to the language. But I believe it should be one or the other -- the draft falls uncomfortably in the middle. Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Multimate International 52 Oakland Ave North E. Hartford, CT 06108