|
|
"bgimeno" <bgimeno[at]persistencia[dot]org> wrote:
> I don't know if there is a special case in which a loop of the variable
> "FooCounter" should remain unchanged.
> But what about a simple detector where the value of "FooCounter" from the
> #while(FooCounter cond) condition does not change when you reach the end of
> the loop?.
First of all, this would require special handling for conditional expressions to
detect the presence of such a construct during parsing.
Furthermore, consider this:
#declare R = seed(4711);
#declare Items = 0;
#while (Items < 10000)
#declare MyPos = SomeRandomPosition(R);
#if (SomeCondition(MyPos))
DoSomething(MyPos)
#declare Items = Items + 1;
#end
#end
Obviously, the problem is more complicated than just checking whether the
variable value actually changes in each loop: Runtime checking won't do, you'd
need code analysis. Also note that the increment may be hidden nested deeply in
macros, so this is not a straightforward check for the existence of a "#declare
FooCounter = ..." somewhere inside the loop.
In my eyes it would be a kludge anyway, so why not heal the leg instead, and add
a proper #for loop - I'm sure we'd have that issue solved then.
(If POV 4 does indeed get a new SDL as promised, I'm quite sure it will not come
without a for loop anyway.)
Post a reply to this message
|
|