POV-Ray : Newsgroups : povray.general : simple syntax question : Re: simple syntax question Server Time
4 Nov 2024 12:58:59 EST (-0500)
  Re: simple syntax question  
From: Christopher James Huff
Date: 15 Dec 2003 17:21:27
Message: <cjameshuff-9F18A3.17212915122003@netplex.aussie.org>
In article <3fdce486$1@news.povray.org>,
 "D. Stimits" <nos### [at] comcastnet> wrote:

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

Maybe you have some misconception of what a macro is. This is simply the 
syntax POV uses...as you said, you have to redeclare a variable to 
modify it. This is unrelated to whether it is a macro or not. It is a 
variable, meaning a value of a specific type referred to by name. If you 
assign 2*2 - 1 to a variable, that variable has the *value* 3, and knows 
nothing about how you specified it.

A macro is an entirely different construct. Macros operate by text 
substitution, modifying the actual code while its being parsed. When the 
macro identifier is used in the scene, its contents replace its 
identifier at the location of its use. If you gave a macro the 
expression 2*2 - 1, its data would consist of that expression. The 
expansion of that macro would then give exactly "2*2 - 1".

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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