POV-Ray : Newsgroups : povray.general : #macro question : Re: #macro question Server Time
20 Nov 2024 06:41:41 EST (-0500)
  Re: #macro question  
From: Ron Parker
Date: 11 Oct 2001 11:23:30
Message: <slrn9sbebk.cj4.ron.parker@fwi.com>
On 11 Oct 2001 11:18:06 -0400, Warp wrote:
>Ron Parker <ron### [at] povrayorg> wrote:
>: Foo(0+C);
>
>: leads to two different results.  B gets set to 5, but C gets left alone, 
>: because "B" can be passed as a reference but the expression "0+C" can't.
>
>  As a programmer I would interpret that in the way that a temporary
>indentifier is created in order to hold the result of "0+C", and a reference
>to this temporary identifier is passed to the macro. After the macro call
>ends, this temporary identifier is destroyed.

Except that's not actually how it's implemented.  A local is created in
both cases, but in one case it's a local of type "reference to parameter" 
and in the other case it's a local of type "floating point value."

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

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