still problems with ?:

Steve Lamont spl at mcnc.org
Fri Jun 9 22:00:39 AEST 1989


In article <562 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) writes:
>From article <2632 at solo1.cs.vu.nl>, by maart at cs.vu.nl (Maarten Litmaath):
>> chris at 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 at ncsc.org
North Carolina Supercomputing Center	Phone: (919) 248-1120
Box 12732/RTP, NC 27709



More information about the Comp.lang.c mailing list