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
26 Apr 2024 11:37:10 EDT (-0400)
  Re: I want to be rid of my stupid mistakes  
From: scott
Date: 21 Jul 2009 06:53:42
Message: <4a659e36@news.povray.org>
>> Check if the loop condition variable is being reassigned inside the loop.
>
>  Impossible in the general case.
>
>  Besides, you are assuming that there is a single unambiguous "loop 
> condition
> variable". The condition in the #while construct can be *anything*. It can 
> be
> a complex expression, it can be a function or macro call, it can contain a
> condition composed of many variables...
>
>  For example, if you had something like this:
>
> #while(xCoord * 2.5 < yCoord * 5 & sqrt(zCoord) < 10 * zSize)
>
> how would POV-Ray check that this isn't an infinite loop?

Impossible to catch all infinite loops, but the parser could check to make 
sure at least one of the variables mentioned in the #while condition is 
reassigned within the loop.  That would catch a lot of mistakes (eg 
forgetting to increment the index variable).


Post a reply to this message

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