When a macro defines a global variable, it doesn't seem to act like one.
Can somebody explain? Or is this a bug?
(Tested on MacOSX and Windows with PB5.24/5.31: same results.)
Code: Select all
DeclareModule TestGlobal
Macro DefineGlobal()
Global a=10
EndMacro
Global b=9
EndDeclareModule
Module TestGlobal
EndModule
UseModule TestGlobal
Procedure Test()
;Global a ;Uncomment this and the results are as expected: a=10
Debug "a="+Str(a) ;Why 0? I expect 10, because a is defined global.
Debug "b="+Str(b)
a=8
b=7
EndProcedure
DefineGlobal()
Debug "a="+Str(a)
Debug "b="+Str(b)
Test()
Debug "a="+Str(a)
Debug "b="+Str(b)
;Debugger results:
; a=10
; b=9
; a=0 ??? why not 10?
; b=9
; a=10 ??? why not 8?
; b=7