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

Doug Gwyn gwyn at smoke.BRL.MIL
Sat May 27 03:19:00 AEST 1989


In article <17757 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>But e1?e2:e3 *can* be turned into (e1&&e2 || !e1&&e3)

Not always; that may evaluate e1 more than once, which matters if e1
has side effects.

Also, the value of e1?e2:e3 is an appropriately promoted value of e2
or e3, whereas the value of (e1&&e2||!e1&&e3) is either 0 or 1.

Just a warning against taking this discussion too literally..



More information about the Comp.lang.c mailing list