#pragma dynamic default value
#1

What is #pragma set to by default? Couldn't find any info on it in pawn-lang.pdf. Is it dependent on how much estimated memory you need? If so, why does the 'recursion warning' thing even exist?
Reply
#2

4000-5000 is the default value AFAIK, was discussed recently on the IRC channel.

I have around 10k for my server, if you require the GPS plugin it requires a massive number, if you check the GPS thread tutorial it is in there somewhere.

The recursion warning calls when there is something like this:

Something where it will call the same stock again and again etc.

So basically, it is where the same function gets called within the same function.

Quote:

stock CallStock()
{
if(tester == 1) { CallStock(); }
else { lol(); tester = 1; }
}

Reply
#3

As far as I know, the value of #pragma dynamic must be greater than the value of the estimated maximum usage (to remove the recursion warning). In my script, I have it 10k.
Reply
#4

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
As far as I know, the value of #pragma dynamic must be greater than the value of the estimated maximum usage (to remove the recursion warning). In my script, I have it 10k.
I know that, I'm just wondering what it's set to by default. Clearly the compiler works out how much memory might be needed, so I guess that is how much is allocated? But when recursion becomes a factor, you get that warning in the compiler box and then you have to increase the dynamic memory allocation (with #pragma dynamic) to get rid of it. Why can't (or doesn't) the compiler just do this anyway?
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Because when you have recursion there is no way for the compiler to know what the highest stack value will be. Recursion is when a function calls itself, so if a function can call itself forever your stack will grow forever.
But after increasing it enough with #pragma dynamic, the warning no longer shows - why can't the compiler just do this itself? I know it doesn't know how much memory is needed, but clearly at some point it thinks there's enough, because the warning goes away.
Reply
#6

I see, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)