POV-Ray : Newsgroups : povray.general : Is this a bug ? #macro (sometimes not) returning values via output parameters : Is this a bug ? #macro (sometimes not) returning values via output parameters Server Time
1 Aug 2024 04:17:09 EDT (-0400)
  Is this a bug ? #macro (sometimes not) returning values via output parameters  
From: povray
Date: 12 Mar 2006 16:58:51
Message: <4414999b@news.povray.org>
I've just spend a few days trying to find a bug in my Povray code. Now I
believe something's wrong with the Povray engine (version
3.6.1b.icl8.win32).
Please take a look at the sample code below to see if I made a mistake. If
you can't find any, please try it on your own system and let me know what
results you found.

Kind regards,

Wil Koenen

/*--------------------------------------------------------------------------
--
Author     : Wil Koenen
Date       : 12 mar 2006
Description: Sample POVRAY code demonstrating an apparent bug.

The code was derived from a much, much larger program, by stripping it down
to the essentials. The problem is that a simple macro does not always change
its output parameter.

The error is deterministic, i.e. the same code produces the same error when
run many times. However, adding #debug directives, or other directives that
should not change the behaviour (e.g. #local dummy=0; ) may change the
behaviour (the iteration number at which the error occurs).

----------------------------------------------------------------------------
*/
#macro f(xx)
   #declare xx=+1; // just a non-zero value
#end

//--------------------------------------------------------------------------
-- 

#declare i = 0;

#while (i< 10000)

        #declare a=-1;

        f(a)

        #local s=concat(
            "i = ", str(i,0,0),
            ", a=", str(a,0,0),
            "\n")

        #if (a>0)
                #debug s
        #else
                #error s
        #end

     #declare i=i+1;
#end


Post a reply to this message

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