adele wrote:reading manual is fine. even finer is to have a try
Generally I'd agree, however, your try isn't either "proofing" or "disproofing",
what's been written, in the DOC (only error is: "function" in description).
The point discussed here, is: does FBC have (or not have) "internal" global variables
My try (regarding to fxm's statement: "Static As Long Err"), proofes it's correctness:
Code: Select all
Static As Long ErrX ' proof of fxm's statements, by MrSwiss -- 2018-03-07
' this Sub can be called a: workaround, making ErrX appear, to be Global
Sub ChgErrX(ByVal NewX As Long, ByRef ErrX As Long) ' internal use of FBC (simulation)
ErrX = NewX
' if ErrX is not used as parameter:
' FBC error 41: Variable not declared, ErrX in 'ErrX = NewX'
' this proofes: that ErrX is NOT Global! (it is module-level, only)
' simulate a Err-Code set by I/O statement (FBC internal)
If ErrX = 0 Then ChgErrX(-32, ErrX)
' straight access below
If ErrX <> 0 Then ErrX = -92
' module-level in scope, is OK! too
If ErrX < 0 Then ErrX = 16 Else ErrX = -16
Print ErrX & " from scope block" ' expected: 16, OK!
' straight change (once again)
ErrX = 1291 ' module-level is OK! as expected
' ----- EOF -----
ErrX, in the code is used as a replacement of Err (prevent conflicts, only).
It also proofes the point, that Err isn't a "global variable". A workaround is needed/used ...