Discussions related to Visual Prolog
-
hyphz
- Posts: 10
- Joined: 15 Jan 2013 1:13
Post
by hyphz »
Hi,
Does the VP7 compiler unwind recursion internally or convert it to branches? For example, if I have the following code:
Code: Select all
pester() :-
write("Say uncle: "),
I = readLine(),
if I <> "uncle" then pester end if.
Is the recursion converted to a branch or could this code potentially trigger a stack overflow if enough "wrong" inputs were entered?
-
Thomas Linder Puls
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
Post
by Thomas Linder Puls »
That code will not cause stack overflow.
You can read more about the
run stack and
last call optimization here:
Memory Management.
Regards Thomas Linder Puls
PDC