generalized switch

Doug Gwyn gwyn at brl-smoke.ARPA
Mon Aug 4 05:30:01 AEST 1986


In article <15093 at ucbvax.BERKELEY.EDU> kos at ernie.Berkeley.EDU (Joshua Kosman) writes:
>	switch() {
>		case <boolean-expr>:
>		    etc.
>		}
>...
>Any ideas?

In C, such code is written:

	if ( bool_expr_1 )
		action_1
	else if ( bool_expr_2 )
		action_2
	else if ...
	else
		default_action

You could come up with some CPP macros for this, but why bother?



More information about the Comp.lang.c mailing list