POV-Ray : Newsgroups : povray.general : #macro question : Re: #macro question Server Time
7 Aug 2024 09:27:07 EDT (-0400)
  Re: #macro question  
From: Warp
Date: 11 Oct 2001 11:18:06
Message: <3bc5b82e@news.povray.org>
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.
  So macros always take "references", but you should know when temporary
identifiers are created in order to avoid mistakes.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

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