[fpc-pascal] Recursion optimization by compiler

Sven Barth pascaldragon at googlemail.com
Sat Sep 4 15:08:50 CEST 2010


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. :)

Btw: is this a CPU dependent optimization?

Regards,
Sven



More information about the fpc-pascal mailing list