e1?(void_e2):(void_e3) so, is it legal or what?

Brett Galloway brett at wjvax.UUCP
Fri Aug 15 02:37:03 AEST 1986

In article <243 at desint.UUCP> geoff at desint.UUCP (Geoff Kuenning) writes:
>While all of this discussion is very interesting and is important to
>achieving a precise language definition, let us not forget that there
>is *no* reason to ever write this particular expression.  Anywhere it's
>useful, you can just write
>	if (e1)
>	    void_e2;
>	else
>	    void_e3;

You are correct, but this is true of ALL uses of '?:`.  In fact, '?:` is
VERY useful, especially when you want to embed conditionals in a macro.
Using the if() {} else {} form restricts the contexts in which the macro
may appear.

Brett Galloway

More information about the Comp.lang.c mailing list