Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!emory!gatech!mcnc!rti!sheol!throopw From: throopw@sheol.UUCP (Wayne Throop) Newsgroups: comp.lang.c Subject: Re: cond. op. on ='s LHS Summary: please explain further... Message-ID: <1196@sheol.UUCP> Date: 16 Feb 91 13:48:04 GMT References: <11073@pasteur.Berkeley.EDU> <15184@smoke.brl.mil> <326@smds.UUCP> <15227@smoke.brl.mil> Lines: 34 - gwyn@smoke.brl.mil (Doug Gwyn) -- rh@smds.UUCP (Richard Harter) -- [.. some context restored ..] -- *(a==b?&c:&d) = -- However the ugly one liner is better code in the sense of not having -- replications of a single term or in using temporaries. [...] In -- principle the idea is a good one but the C conditional expression is -- just too darned ugly. - There are good ways of exploiting the ?: operator and bad ways. - The example being discussed is clearly among the latter. I'm not sure I understand. Could either Doug or Richard expand a little on just why the expression is "ugly" or a "bad way" to exploit the conditional operator? It doesn't seem any worse than, say foo[a==b?c:d] = something; or even just foo[(a+b)*(c+d)] = something; or the like. All are examples of a complicated decision going into exactly which object is going to be assigned to. Granted, the conditional is more extreme than the subscripting examples, but not to any large degree IMHO. So why is the explicit conditional any worse than the others? ( Note: the restored context above may have obliterated the "example being discussed" by Doug. If the example I left there isn't the one he means, forgive me. ) -- Wayne Throop !mcnc!rti!sheol!throopw or sheol!throopw@rti.rti.org