// Using the same identifier name across call/include, stacks/hierarchies using // a mix of #local and #declare directives can introduce confusing instability. //--- test.pov #macro Add(_V1,_V2) //#local V1 = _V1+_V2; // AAA #debug concat("V1 Add ",str(V1,5,0),"\n") #declare V1 = Plus(_V1,_V2); #debug concat("V1 Add Post Plus() ",str(V1,5,0),"\n") V1 #end #macro Plus(V1,V2) (V1+V2) #end #macro AddAlt(_V1,_V2) //#local V1 = 11; // BBB #declare V1 = 77; #debug concat("V1 AddAlt ",str(V1,5,0),"\n") //#local V1 = 33; // CCC #local V2 = (Add(_V1,_V2)); #debug concat("V2 AddAlt Post Add() ",str(V2,5,0),"\n") V2 #end #declare _immu = 42; #declare V1 = 55; #declare Val99 = AddAlt(_immu,1); #debug concat("_immu ",str(_immu,5,0),"\n") #debug concat("V1 ",str(V1,5,0),"\n") #error "stop" //--- End test.pov // Outputs below showing a few examples of the volatility of identifier values // possible when mixing #local and #declare with the same identifier name across // a call/include hierarchy. (Macros create a level when they are executed) // V1 AddAlt 77 // Original test.pov // V1 Add 77 // V1 Add Post Plus() 43 // V2 AddAlt Post Add() 43 // _immu 42 // V1 43 // V1 AddAlt 77 // Uncomment only line AAA // V1 Add 43 // V1 Add Post Plus() 43 // V2 AddAlt Post Add() 43 // _immu 42 // V1 77 // V1 AddAlt 77 // Uncomment only line BBB // V1 Add 77 // V1 Add Post Plus() 43 // V2 AddAlt Post Add() 43 // _immu 42 // V1 55 // V1 AddAlt 77 // Uncomment only line CCC // V1 Add 33 // V1 Add Post Plus() 43 // V2 AddAlt Post Add() 43 // _immu 42 // V1 77