Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers From: kers@hplb.hpl.hp.com (Chris Dollin) Newsgroups: comp.lang.c Subject: Re: cond. op. on ='s LHS Message-ID: Date: 15 Feb 91 09:25:33 GMT References: <4155@cernvax.cern.ch> <1991Feb13.223412.28254@grebyn.com> Sender: news@hplb.hpl.hp.com (Usenet News Administrator) Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 26 In-Reply-To: ckp@grebyn.com's message of 13 Feb 91 22:34:12 GMT Nntp-Posting-Host: cdollin.hpl.hp.com Someone (I've lost the attribution) asked how people felt about: > *(a==b?&c:&d) = 1; > >instead of: > > if (a==b) c=1; > else d=1; I'll add my agreement; the first one is "Ugh". But .. how would people feel if conditionals could deliver lvalues, ie, so that (a == b ? c : d) = 1; was legal and had the obvious meaning? (Clearly, when c, d, and especially 1 are more complex expressions, you might wish to make it abundantly clear that a *single* value was being assigned to one or other localtion.) If anyone sees fit to respond to this, I suggest they switch newsgroups to comp.lang.misc, as it will no longer be much to do with C ... -- Regards, Kers. | "You're better off not dreaming of the things to come; Caravan: | Dreams are always ending far too soon."