Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: net.lang.c,net.lang Subject: Multiple assignments Message-ID: <1455@mmintl.UUCP> Date: Mon, 12-May-86 01:23:17 EDT Article-I.D.: mmintl.1455 Posted: Mon May 12 01:23:17 1986 Date-Received: Wed, 14-May-86 07:25:07 EDT References: <501@brl-smoke.ARPA> <797@bentley.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Followup-To: net.lang Organization: Multimate International, E. Hartford, CT Lines: 28 Xref: linus net.lang.c:8228 net.lang:2172 In article <797@bentley.UUCP> kwh@bentley.UUCP writes: >In article <501@brl-smoke.ARPA> rbj@icst-cmr (Root Boy Jim) writes: >>And as someone pointed out, assignments return a value too, so should we >>cast them to void as well? Oh yeah, assignment is `different'. > >Actually, this does bother me somewhat. I think I prefer the idea that >values should be used or explicitly discarded, as in forth. (Not that forth >has any error checking!) No, I'm not suggesting that lint should complain >about assignments, or that C should have a different notation for assignments >that are being pipelined into another expression. Just waiting for the next >generation of languages. This bothers me somewhat too. I do have a suggestion for how to deal with it: have a "multi-assignment" operator. Supposing that "$" is being used for this operator, then to set both "a" and "b" to zero, one would write "a $ b = 0", rather than "a = b = 0", as C does. This has the disadvantage that it cannot be used where the result of the assignment is used immediately in a calculation (e.g., "a = 2 * b = sqrt(c)"). On the other hand, if your language supports argument passing by address, it permits an output argument to be multiply assigned; something which assignment-with-value does not support. I am not recommending that this be put into C. It is an idea for new languages. Accordingly, I have directed follow-ups to net.lang instead of net.lang.c. Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Multimate International 52 Oakland Ave North E. Hartford, CT 06108