AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

recursive function quits after 270 recursions?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
pantagruel



Joined: 08 Oct 2006
Posts: 91
Location: denmark

PostPosted: Wed Jul 09, 2008 7:20 pm    Post subject: recursive function quits after 270 recursions? Reply with quote

Hi,

I have a recursive function:

Code:
#a:: sender(329,1000)

sender(fromnum,tonum){

if(fromnum < tonum){
Send x
Send %fromnum%
Send {Enter}

sender(fromnum + 1,tonum)
   
    }
}


it quits at printing x599.

I could understand it if I was concatenating a string, or it operated on a recursive structure, but all it does is call itself as long as the first parameter is less than the second.
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1259
Location: Denmark

PostPosted: Wed Jul 09, 2008 8:17 pm    Post subject: Reply with quote

Limited stackspace. Rewrite without:

Code:
#a::sender(329,400)

sender(fromnum,tonum){
  if (fromnum < tonum)
  {
    loop % tonum - fromnum
    {
      Send x
      Send %fromnum%
      Send {Enter}
      fromnum++
    }
  }
}

_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group