[net.lang.c] Reply to jeff at isi-vaxa

grt@twitch.UUCP ( G.R.Tomasevich) (08/26/86)

The mail failed with some long reply I don't understand.

<	if (
<	    ( (status = step_1()) == SUCCESS) &&
<	    ( (status = step_2()) == SUCCESS) &&
<			.
<			.
<			.
<	    ( (status = step_3()) == SUCCESS)
<	);

One way to avoid this is to store the pointers to the functions step_?()
in an array and then run a for() loop with a break on failure.  E. g.:

int step_1(), step_2() ...;
int (*fst[])() = { step_1, step_2, ... };
#define N some_number	/* whatever number there are */

	int i, status;
	for(i=0; i<N; i++)
		if((status = (*fst[i])()) == FAILURE)
			break;

I checked this with trivial functions.
-- 
	George Tomasevich, ihnp4!twitch!grt
	AT&T Bell Laboratories, Holmdel, NJ