C style

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Sun Oct 27 17:07:32 AEST 1985


If this code needs to grow much more, it might be better to
make it table-driven:

	i = 0;
	do	{
		static int (*funcs[])() = { func1, ..., 0 };
		int (*fp)() = funcs;

		do
			ret[i] = (*fp)( args );
		while ( ret[i] == GOOD && *++fp );
		}
	while ( ret[i] == GOOD && ++i < MAX_RETS );

This example isn't precisely equivalent to the original, but
it accomplishes the same general goal.



More information about the Comp.lang.c mailing list