is recursion necessary? (was Re: Should I convert FORTRAN code to C?)

Wayne Schlitt wayne at dsndata.uucp
Sun Jul 10 04:42:29 AEST 1988



I used to think that recursion was unnecssary and very expensive, but
now i am not so sure.  what about the cases where you recurse from
more than one place?  can you do that without a stack of flags and
lots of ifs?  an example, how would you do something like this:


void fna( x, y, z )
    int x, y, z;
{
    /* a bunch of setup */

    if( /* some test */ )
    {
	/* a bunch of code */

	fna( a, b, c );

	/* a bunch more code */
    }
    else
    {
	/* some different code */

	if( /* some other test */ )
	    fna( d, e, f );

	/* yet some more code */
    }

}


--
Wayne Schlitt                                  |  Design Data Corporation
hplabs!hpfcla ----------\                      |  1033 "O" St.  Suite 324
ncar!handel!hpfcla ------>---> !dsndata!wayne  |  Lincoln Ne, 68508
ihnp4!upba -------------/                      |  (402) 476-8278



More information about the Comp.lang.c mailing list