[fpc-pascal] Recursion optimization by compiler

Florian Klämpfl florian at freepascal.org
Sat Sep 4 17:58:46 CEST 2010


Am 04.09.2010 15:08, schrieb Sven Barth:
> On 28.08.2010 11:57, Florian Klämpfl wrote:
>> Am 03.09.2010 21:31, schrieb Sven Barth:
>>> On 03.09.2010 18:02, Marco van de Voort wrote:
>>>>
>>>>> Second, does FPC understand "tail recursion"?
>>>>
>>>> Depends on version, do
>>>>
>>>> fpc -i |grep -i tailrec
>>>>
>>>> to find out more.
>>>
>>> O.o
>>>
>>> Ok... now I'm officially impressed.
>>
>> Well, simple to implement and useless optimization :)
> 
> But it's nice to have.
> 
> In the lecture "Introduction of Computer Science 2" we had to learn
> functional programming with the programming language OCaml. There we
> used tail recursion a lot (and I always tried to write my functions in a
> tail recursive form) and it's nice to see/know that FPC can do that as
> well. :)

IIRC in the whole FPC source tree are two cases where this optimization
is applied :)

> 
> Btw: is this a CPU dependent optimization?
> 

No.




More information about the fpc-pascal mailing list