GLBasic forum

Feature request => IDE/Syntax => Topic started by: FutureCow on 2009-May-29

Title: dimming global arrays
Post by: FutureCow on 2009-May-29
I would like to be able to say
global dim myarray[20]

rather than having to do
global myarray[]
dim myarray[20]
Title: Re: dimming global arrays
Post by: Schranz0r on 2009-May-29
Code: GLBasic [Select]
global dim myarray[20]

Thats bad code!
Title: Re: dimming global arrays
Post by: FutureCow on 2009-May-29
Why? I want to make an array of 20 fields and I want it global. It makes a lot more sense to me than having to do
global myarray[]
dim myarray[20]

What is bad about the one line version?
Title: Re: dimming global arrays
Post by: Schranz0r on 2009-May-29
DIM are allways global ;)
Title: Re: dimming global arrays
Post by: Moru on 2009-May-30
But if you dim an array you get a warning, that isn't realy good either I would say :-)

DIM myarray[5]
warning : implicitly created GLOBAL  : myarray

First you declare the variable
GLOBAL myarray[]

then you set the size in an INIT: function or something:
DIM myarray[5]
Title: Re: dimming global arrays
Post by: S. P. Gardebiter on 2009-Jun-03
I'm all for the:

Global Dim Array[20]

Too. :P

Makes life so easier, plus in other Basic languages is totally the same for example VB:

Public Array(20) As Integer

And not:

Public Array() as Integer
Redim Array(20)