|
|
>> 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
|
|