Steve,
If you're looking for equivalent to "return X", use "Exit" with a
parameter in Pascal: "Exit(X)".
It's just a shortcut for "Result := X; Exit;"
Regards,
Michalis
pon., 12 cze 2023 o 19:57 Steve Litt via fpc-pascal
napisał(a):
>
> Nikolay Nikolov via fpc-pascal said on Mon, 12 Jun 2023
Nikolay Nikolov via fpc-pascal said on Mon, 12 Jun 2023 09:15:17 +0300
>On 6/12/23 04:44, Steve Litt via fpc-pascal wrote:
[snip]
>> So, subject to your guidance, I'm assuming FPC isn't optimized for
>> tail recursion. Is my assumption an accurate one?
>
>FPC supports tail recursion
Marco van de Voort via fpc-pascal said on Mon, 12 Jun 2023 09:12:22
+0200
>On 12-6-2023 08:15, Nikolay Nikolov via fpc-pascal wrote:
>
>Shouldn't the recursive call assign the result?
>
>> nextt(num - 1);
>
>
>nextt:=nextt(num - 1);
>
>
>if you don't use the result, the whole call may be
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
According to you other posts, I won't be surprised that you think in a
C/C++ way.
This doesn't change anything in your last example, but particularly :
nextt := num;
doesn't behave like in C :
return num;
In pascal I think the equivalent would be :
nextt := num; exit;
Many thanks.
On Mon, 12 Jun 2023 at 16:37, gabor via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:
> Currently, libxml2 headers are outdated and partially
> incorrect/incomplete. I updated the headers a couple of years ago. You
> can find the patch file here:
>
>
Currently, libxml2 headers are outdated and partially
incorrect/incomplete. I updated the headers a couple of years ago. You
can find the patch file here:
https://gitlab.com/freepascal.org/fpc/source/-/issues/38905
Michał.
W dniu 2023-06-12 o 17:12, David Connolly via fpc-pascal pisze:
Hi
Hi all,
I upgraded to Debian 12 today and I've noticed some weird behaviour with
libxml2.
Free Pascal Compiler version 3.2.2+dfsg-20 [2023/03/30] for x86_64
program xml;
uses
xml2;
begin
end.
This program compiles fine, but will not run against the updated version of
libXML2.
The call of
On 12-6-2023 08:15, Nikolay Nikolov via fpc-pascal wrote:
Shouldn't the recursive call assign the result?
nextt(num - 1);
nextt:=nextt(num - 1);
if you don't use the result, the whole call may be optimized away?
___
fpc-pascal maillist -
On 6/12/23 04:44, Steve Litt via fpc-pascal wrote:
Hi all,
Tail recursion is recursion in which absolutely nothing gets executed
after the return statement. Some programming languages, including
Guile, optimize for tail recursion such that tail recursive algorithms
don't use additional stack
10 matches
Mail list logo