Problem with ()?():() as ending test in for-loop

Larry Jones scjones at sdrc.UUCP
Fri May 26 07:48:08 AEST 1989


In article <17722 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
> Any valid `logical' [true/false]
> e1?e2:e3 expression can always be transformed this way into (e1&&e2)||e3,
> provided e3 has no side effects.

Eh?  If e1 and e3 are true while e2 is false, then e1?e2:e3 is
false but (e1&&e2)||e3 is true.  Seems to me you can't avoid
having to do (e1&&e2)||(!e1&&e3).
----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at SDRC.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
"You can't get a body like mine in a bottle --
unless you push REAL HARD." - Judy Tenuta / Dr. Pepper



More information about the Comp.lang.c mailing list