Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!harpo!utah-cs!utah-gr!thomas From: thomas@utah-gr.UUCP (Spencer W. Thomas) Newsgroups: net.lang.c Subject: Re: the "broken" statement - (nf) Message-ID: <933@utah-gr.UUCP> Date: Sun, 16-Oct-83 22:40:41 EDT Article-I.D.: utah-gr.933 Posted: Sun Oct 16 22:40:41 1983 Date-Received: Mon, 24-Oct-83 23:00:06 EDT References: uiucdcs.3219 Lines: 16 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