[net.lang.c] the "broken" statement

thomas@utah-gr.UUCP (Spencer W. Thomas) (10/17/83)

Ok, here is a solution (admittedly gross, but works) using only
"standard" C.  Of course, the terminal action must be an expression (no
for or if statements allowed).  An example follows.

/* Construct to perform a terminal action at the end of a loop. */
/* Note - should really cast (term_act) to (int), else lint complains */
#define AT_END(log_exp,term_act)   ( (log_exp) ? TRUE : ( (term_act),FALSE ) )

	for ( i = 0; AT_END( i < n, not_found() ); i++ )
		if ( some_condition )
		{
			found();
			break;
		}

=Spencer