POV-Ray : Newsgroups : povray.pov4.discussion.general : I want to be rid of my stupid mistakes : Re: I want to be rid of my stupid mistakes Server Time
31 Oct 2024 19:38:03 EDT (-0400)
  Re: I want to be rid of my stupid mistakes  
From: Trevor G Quayle
Date: 22 Jul 2009 08:55:00
Message: <web.4a670b1d97aca27181c811d20@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> scott <sco### [at] scottcom> wrote:
> > >  What if there are no variables mentioned there?
>
> > It can just ignore it, the purpose is to catch a mistake like when you
> > forget to increment the index counter, not catch all infinite loops (that is
> > impossible).
>
>   If the variable mentioned in the condition is not the variable which
> changes and decides when the loop ends, the checker would give a false
> positive.
>
> --
>                                                           - Warp

Perhaps the easiest and most universal solution to implement would be to add a
global "loop_limit" variable that would set the maximum number of loops allowed
(similar to max_trace value).  POV would then only need to keep track of the
number of iterations the current loop has gone through and kick it out when it
reaches the limit, rather than tracking any number of variables.  I would
expect that POV would also report an error (without aborting) to the message
window that a loop was terminated with the line number for debugging purposes.
To allow infinite loops as the current functionality is, one would set
loop_limit to 0 or -1.
The one disadvantage to this is that it would be globaL and apply to all loops
within the scene.

-tgq


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.