POV-Ray : Newsgroups : povray.bugreports : The macro scope / identifier / semicolon bug : Re: The macro scope / identifier / semicolon bug Server Time
28 Mar 2026 14:48:01 EDT (-0400)
  Re: The macro scope / identifier / semicolon bug  
From: Bald Eagle
Date: 23 Mar 2026 17:50:00
Message: <web.69c1b537b3a149a81f9dae3025979125@news.povray.org>
Which is the same macro construct as the following:

// ------------------ Scalar failure ---------------------------
#macro BugScalar(A,B,X)
    #if (X < A)
        0
    #else
        ((X - A) / (B - A))
    #end
#end



// ------------------ Vector failure ---------------------------
#macro BugVector(X)
    #if (X < 0.5)
        <1,0,0>
    #else
        <0,1,0>
    #end
#end



However this works:
#macro Test (N)
 0
#end
#local Val = Test (1);

and (provisionally)

#macro Test (N)
    #if (N < 1)
        #local Result = 0;
    #else
        #local Result = 1;
    #end
    Result
#end

#local Val = Test (1);

Also, as Mr. Callwood advised in an older thread,
wrapping the internals of the macro in parentheses allows successful evaluation:

#macro BugScalar(A,B,X)
(
    #if (X < A)
        0
    #else
        ((X - A) / (B - A))
    #end
)
#end


Post a reply to this message

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