POV-Ray : Newsgroups : povray.general : paramters of macros (POV-Ray 3.1 bug?) Server Time
13 Aug 2024 19:24:00 EDT (-0400)
  paramters of macros (POV-Ray 3.1 bug?) (Message 1 to 4 of 4)  
From: Friedemann Schmidt
Subject: paramters of macros (POV-Ray 3.1 bug?)
Date: 15 Jul 1998 22:01:43
Message: <35ad50e7.4530171@news.povray.org>
Hi,

if I declare a macro like

  #macro Macro(A)
    #declare A = A + 1;
  #end

or

  #macro Macro(A)
    #local A = A + 1;
  #end
    
and call it like

  #declare X = 1;
  Macro(X)

X cahnges to 2. That's like calling a function in C by reference.

The documentation (page 106) says:

"When the macro is invoked, a new local symbol table is created. The
actual parameters are assigned to formal parameter identifiers as
local, temporary variables. POV-Ray jumps to the body of the macro and
continues parsing until the matching #end directive is reached. There,
the local variables created by the parameters are destroyed as well as
any local identifiers expressly created in the body of the macro."

I think, this is a contradiction to the effect above.

Does anyone know if it's a bug or didn't I understand the
documentation right?

Thanks in advance,
Friedemann


Friedemann Schmidt
Fri### [at] Stonescom
Raytracing-Gallery: http://www.rz.fhtw-berlin.de/~s0049669


Post a reply to this message

From: Friedemann Schmidt
Subject: Re: paramters of macros (POV-Ray 3.1 bug?)
Date: 15 Jul 1998 22:15:35
Message: <35ad5432.5373410@news.povray.org>
Sorry, I posted without reading the whole page of the documentation.
The paragraph "Returning Values Via Parameters" says, that it is
correct when the identifier with which the macro was called changes to
a new value. But I think this is a contradiction to the quoted
paragraph, isn't it?

Best regards,
Friedemann





Friedemann Schmidt
Fri### [at] Stonescom
Raytracing-Gallery: http://www.rz.fhtw-berlin.de/~s0049669


Post a reply to this message

From: Nathan Kopp
Subject: Re: paramters of macros (POV-Ray 3.1 bug?)
Date: 16 Jul 1998 00:02:04
Message: <35AD7C1C.C9D5880F@ltu.edu>
I think that the first paragraph that you quoted is talking about when you
call the macro like the following:

#declare X = 1;
Macro(X+50)

In this case, a new local symbol is created and no value is returned.  I
haven't read the documentation yet, so it may not be clear on this point.

-Nathan Kopp

Friedemann Schmidt wrote:
> 
> Sorry, I posted without reading the whole page of the documentation.
> The paragraph "Returning Values Via Parameters" says, that it is
> correct when the identifier with which the macro was called changes to
> a new value. But I think this is a contradiction to the quoted
> paragraph, isn't it?
>


Post a reply to this message

From: Friedemann Schmidt
Subject: Re: paramters of macros (POV-Ray 3.1 bug?)
Date: 16 Jul 1998 00:59:47
Message: <35ad7a93.8166967@news.povray.org>
Nathan Kopp <nk8### [at] ltuedu> wrote:
>I think that the first paragraph that you quoted is talking about when you
>call the macro like the following:
>
>#declare X = 1;
>Macro(X+50)
>
>In this case, a new local symbol is created and no value is returned.  I
>haven't read the documentation yet, so it may not be clear on this point.

Yes, that's right. because X+50 is a constant RVALUE, that can't be
changed. The documentation says:

"Values may only be returned via a parameter if the parameter is an
IDENTIFIER. Parameters that are RVALUES are constant values that
cannot return information"



Bye,
Friedemann


Friedemann Schmidt
Fri### [at] Stonescom
Raytracing-Gallery: http://www.rz.fhtw-berlin.de/~s0049669


Post a reply to this message

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