|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |