Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!eecae!upba!dsndata!wayne
From: wayne@dsndata.uucp (Wayne Schlitt)
Newsgroups: comp.lang.c
Subject: is recursion necessary?  (was Re: Should I convert FORTRAN code to C?)
Message-ID: 
Date: 9 Jul 88 18:42:29 GMT
References: <2742@utastro.UUCP> <4700015@m.cs.uiuc.edu>
Sender: wayne@dsndata.UUCP
Organization: Design Data
Lines: 38
In-reply-to: kenny@m.cs.uiuc.edu's message of 6 Jul 88 03:39:00 GMT



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