Thanks Lance, it does help.
------------------
Announcement
Collapse
No announcement yet.
Globals and Dimensioning
Collapse
X
-
At present, the GLOBAL clause is actually optional, but recommended for clarity since it is possible to have a local array with the same name as a global array.
Essentially, if you explicitly add the GLOBAL clause, there is no ambiguity when you come back to review the code in 2 years time. Think of it as a small step toward more easily maintainable code.
The current behavior _could_ change in future editions of the compiler, so it would be a safe bet to add the GLOBAL clause where appropriate. If the behavior does not change, it costs you nothing except improved clarity.
I hope this helps!
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
-
Globals and Dimensioning
I stumbled on the following statement in the manual on p.254:
"If an array is defined as GLOBAL outside of a Sub or Function, you must still
include the GLOBAL keyword in the DIM statement"
i.e. DIM a(1 to 500) AS GLOBAL STRING
I have a lot of arrays that I declare in an inc file outside of all Subs and
Functions, but which I dimension without redeclaring them as GLOBAL and type.
I have never had any problems with the code (as far as I know).
I wonder if the manual is in error here, or if I need to go back and change
all my dimension statements. Would appreciate some help.
------------------
Tags: None
-
Leave a comment: