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
6 May 2024 21:30:42 EDT (-0400)
  Re: I want to be rid of my stupid mistakes  
From: Warp
Date: 20 Aug 2009 10:45:36
Message: <4a8d618f@news.povray.org>
scott <sco### [at] scottcom> wrote:
> > #macro Next()
> >   #declare I=I+1;
> > #end
> >
> > #declare I=0;
> > #while (I < Limit)
> >   Next()
> > #end
> >
> > No mention of I anywhere in the loop, yet perfectly finite.
> >
> > You *must* dig into *every* macro to catch this.

> The parser re-parses the macro every time it is called though, doesn't it? 
> So the parser simply needs to look out for any "#declare I" any time it is 
> parsing commands within the loop, no matter if it is in a macro or not.

  It doesn't necessarily parse it every time. You could have something like:

#declare I=0;
#while (I < Limit)
    #if(rand(someSeed) < 0.5)
        Next()
    #end
#end

-- 
                                                          - Warp


Post a reply to this message

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