POV-Ray : Newsgroups : povray.bugreports : local in macro : local in macro Server Time
25 Apr 2024 17:30:22 EDT (-0400)
  local in macro  
From: jr
Date: 28 Nov 2019 07:25:01
Message: <web.5ddfbbcda28041b5feeb22ff0@news.povray.org>
hi,

upgraded from alpha.9945627 because I ran into a problem, to alpha.10064268, but
no change.

reading section 3.3.2.2.2 "declare vs local", it says if "#local is used inside
a #macro then the identifier is local to that macro.  When the macro is invoked
and the #local directive is parsed, the identifier is created."

maybe I misread this, but the macro parameter appears to just work as an
input/output.  the following test scene .. misbehaves on both versions:

-----<snip>-----
#version 3.8;

global_settings {assumed_gamma 1}

#macro Decr(n_)
  #if (1 <= n_)
    #local n_ = n_ - 1;
  #end
  #debug concat("local n_ = ",str(n_,0,0),"\n")
#end


#if (1)
#for (i_,0,3)
  Decr(i_)
  #debug concat("loop i_ = ",str(i_,0,0),"\n")
#end
#end


#if (0)
#declare i_ = 0;
#while (4 > i_)
  Decr(i_)
  #debug concat("loop i_ = ",str(i_,0,0),"\n")
  #declare i_ = i_ + 1;
#end
#end
-----<snip>-----


regards, jr.


Post a reply to this message

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