POV-Ray : Newsgroups : povray.general : semi-colon in macro ? : Re: semi-colon in macro ? Server Time
11 Aug 2024 09:22:55 EDT (-0400)
  Re: semi-colon in macro ?  
From: PoD
Date: 16 Aug 1999 18:54:35
Message: <37B89725.17F74328@merlin.net.au>
ingo wrote:
> 
> Three little macro's. The first and third are ok, the second is not. The only
> difference between Twee and Drie is the position of the semi-colons. I
> understand that a macro works by text replacement. That does not make me
> understand why Twee doesn't work and Drie does. Can somebody explain?
> 
> #macro Een(A,B,C)
>    A+B+C
> #end //macro
> #declare Som1=Een(1,2,3);
> sphere {Som1,1}
> 
> #macro Twee(A,B,C)
>    #local P=A+B+C;
>    #if (P=0)
>       A+B-C
>    #else
>       A+B+C
>    #end
> #end
> #declare Som2=Twee(1,2,3);
> sphere {Som2,1}
> 
> #macro Drie(A,B,C)
>    #local P=A+B+C;
>    #if (P=0)
>       A+B-C;
>    #else
>       A+B+C;
>    #end
> #end
> #declare Som3=Drie(1,2,3)
> sphere {Som3,1}
> 
> ingo
> --
> Met dank aan de muze met het glazen oog.

I can't say exactly why this is the case, Twee is the way it should
work.
Note that Drie won't work if you say sphere{Drie(1,2,3),1}
If you say #declare Som2=Twee(1,2,3) without the semi colon, it works
but gives a warning.

Cheers, PoD.


Post a reply to this message

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