POV-Ray : Newsgroups : povray.general : Is this a bug ? #macro (sometimes not) returning values via output parameters Server Time
29 Oct 2024 23:54:05 EDT (-0400)
  Is this a bug ? #macro (sometimes not) returning values via output parameters (Message 1 to 4 of 4)  
From: povray
Subject: Is this a bug ? #macro (sometimes not) returning values via output parameters
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

From: Tim Nikias
Subject: Re: Is this a bug ? #macro (sometimes not) returning values via output parameters
Date: 12 Mar 2006 19:16:11
Message: <4414b9cb@news.povray.org>
It is a known bug and, AFAIK, should be adressed in the next update.

Regards,
Tim

-- 
aka "Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Slime
Subject: Re: Is this a bug ? #macro (sometimes not) returning values via output parameters
Date: 12 Mar 2006 22:24:31
Message: <4414e5ef$1@news.povray.org>
> It is a known bug and, AFAIK, should be adressed in the next update.

FYI, the workaround is to not pass variables by reference. If you need a
macro to return more than one value, have it return its results through
global variables; call the macro and read the variables it sets.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: povray
Subject: Re: Is this a bug ? #macro (sometimes not) returning values via output parameters
Date: 13 Mar 2006 12:34:20
Message: <4415ad1c$1@news.povray.org>
"Tim Nikias" <JUSTTHELOWERCASE:timISNOTnikias(at)gmx.netWARE> wrote in
message news:4414b9cb@news.povray.org...
> It is a known bug and, AFAIK, should be adressed in the next update.

Indeed, I tested on 3.7.0.beta.11c.icl8-sse2.win32 and the problem was gone.

Thanks for your help.

Wil Koenen


Post a reply to this message

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