Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!gatech!mcnc!spl From: spl@mcnc.org (Steve Lamont) Newsgroups: comp.lang.c Subject: Re: still problems with ?: Message-ID: <4675@alvin.mcnc.org> Date: 9 Jun 89 12:00:39 GMT References: <2632@solo1.cs.vu.nl> <562@lakart.UUCP> Reply-To: spl@mcnc.org.UUCP (Steve Lamont) Organization: Microelectronics Center of NC; RTP, NC Lines: 26 In article <562@lakart.UUCP> dg@lakart.UUCP (David Goodenough) writes: >From article <2632@solo1.cs.vu.nl>, by maart@cs.vu.nl (Maarten Litmaath): >> chris@mimsy.UUCP (Chris Torek) writes: >> \... >> \But e1?e2:e3 *can* be turned into (e1&&e2 || !e1&&e3) >> >> But what if e1 == *p++? > >Simple: > >((a = *p++) && e2 ) || (!a && e3) Is right to left evaluation mandated in this case? It seems to me that I've been bitten by things like this before, either by non-standards conforming compilers, ambiguous definition in the standard, my own stupidity, or all of the above. In any case, it seems that defensive programming might dictate something like (a = *p++), ( ( a && e2 ) || (!a && e3) ) What say the gurus? Or is this an RTFM? -- spl Steve Lamont, sciViGuy EMail: spl@ncsc.org North Carolina Supercomputing Center Phone: (919) 248-1120 Box 12732/RTP, NC 27709