On Wed, 7 Feb 2001, Boian Bonev wrote:

> hi,
>
> indeed it is theoretically impossible to track this :)
>
> implement a recursive alrorithm for something e.g.:
>
> function foo($n) { // calc $n!
>     if ($n<=1)
>         return $n;
>     else
>         return foo($n-1)*$n;
> }
>
> now tell me if it is infinite or finite? ;-) this is a verification and
> cannot be solved runtime.
>
> the best thing that can be done is to set a stack limit (php function call
> level) to something reasonable and thus avoid the segfault.

This gives a problem itself, how many levels before the stack is full? Not
every function call has the same memory footprint, so you can't tell after
how many levels the stack is full.

Derick Rethans

---------------------------------------------------------------------
      PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
---------------------------------------------------------------------
    JDI Media Solutions - www.jdimedia.nl - [EMAIL PROTECTED]
     H.v. Tussenbroekstraat 1 - 6952 BL Dieren - The Netherlands
---------------------------------------------------------------------


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to