POV-Ray : Newsgroups : povray.general : simple syntax question : Re: simple syntax question Server Time
4 Nov 2024 13:03:04 EST (-0500)
  Re: simple syntax question  
From: D  Stimits
Date: 14 Dec 2003 17:30:30
Message: <3fdce486$1@news.povray.org>
Christopher James Huff wrote:

> In article <3fd9b52a@news.povray.org>,
>  "D. Stimits"  wrote:
>
>
> >This works. Prior to this I made the mistake of not using declare after
> >the variable was declared, a bit of a C-ism. But since it is really a
> >macro expansion, it isn't a lot like C, the use of declare each and
> >every modification of Node_Center does the job :)
>
>
> It sounds like you have a misunderstanding here. The #declare statement
> is not a macro declaration. It declares an actual variable. After
> "#declare A = 2+2;", "A" is a variable containing the value 4, not a
> macro expanding to the string "2+2".

Yes, you are correct, it was my C'ish background that the #declare style 
would be a macro.

>
> For modifying variables, the #declare or #local is necessary. This is
> just a syntax issue, and has nothing to do with macros. (In MegaPOV,
> there is a #set keyword specifically for modifying existing variables
> without the possibility of accidentally creating a new one.)


Not familiar with MegaPOV. However, this is where it again becomes 
non-intuitive for C/C++ background...there is no need in those languages 
to use something like #declare twice. This is why I called it a macro, 
that I have to use #declare to essentially redeclare the same thing with 
a new value. Even though it is a true variable, it seems I have to 
essentially redefine it each change, which was hanging me up.


Post a reply to this message

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