Call Procedure inside Procedure = Overflow !?

Everything else that doesn't fall into one of the other PB categories.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Call Procedure inside Procedure = Overflow !?

Post by va!n »

Hi!
I am trying to write a small procedure with some differents if conditions inside... if the condition check is TRUE, i have to call the Proecdure again! (also its like recursive coding!?)

All works fine, for some loops... then it will crash or with enabled debugger i got a message "invalid memory adress" !!

I think each time when calling a procedure the stack pointer will increase and after some time its a overflow!? Is there any way to solve the problem with another coding style or how ever? thanks

here is a very small example what i mean! But please not, my procedure will exit after some loops! Following example will never end, its just only to show you what i mean when talking about "calling the same procedure inside a procedure)

Code: Select all

Procedure Overflow(test)
  If test = 1 : Overflow(1) : EndIf
EndProcedure

Overflow(1)
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

this some times happens with recursive code
what you have is a infinity loop of allocating memory until the limit is reached which causes a over flow

all i can say do could make a point were it can get out and close all procedures
~Dreglor
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

El_Choni
Post Reply