Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: possible to write translate program from recursive C to no recursive C?

Author: Dann Corbit

Date: 11:19:46 09/15/03

Go up one level in this thread


On September 15, 2003 at 00:04:21, Uri Blass wrote:

>Can programmers write a program that take a code with recursive functions and
>translate it to a code without recursive functions that does the same thing?
>
>Do not answer me that the compiler does it by translating it to assembler
>because the translation should be done to a program in the same computer
>language so a C source should be translated to another C source.

Modern compilers can remove tail recursion most of the time.

You can always eliminate recursion by maintaining your own explicit stack.  I
have done that in the past.

If the algorithm is more clear in its recursive form (as is often the case) I do
not recommend trying to change it unless you have powerful reason to believe
that the routine is a bottleneck in performance.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.