[fpc-pascal] fpc isn't optimised for tail recursion, is it?

Steve Litt slitt at troubleshooters.com
Mon Jun 12 19:05:30 CEST 2023


Jean SUZINEAU via fpc-pascal said on Mon, 12 Jun 2023 18:04:07 +0200

>According to you other posts, I won't be surprised that you think in a 
>C/C++ way.

:-) Busted! I used Pascal 1984-1993, and C 1986-present with C++ (hate
it) 1990-1998. So I long ago forgot the details of pascal, and program
pretty much every language with a C accent.

>This doesn't change anything in your last example, but particularly  :
>
>nextt := num;
>
>doesn't behave like in C :
>
>return num;

Busted again. I was thinking that nextt := num not only defined the
return value, but actually executed the return. Because that's how the
return statement works in C. I now know (remember actually) that the
assignment doesn't trigger the return.

Thanks,

SteveT



More information about the fpc-pascal mailing list