dimming global arrays

Previous topic - Next topic

FutureCow

I would like to be able to say
global dim myarray[20]

rather than having to do
global myarray[]
dim myarray[20]

Schranz0r

Code (glbasic) Select
global dim myarray[20]

Thats bad code!
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

FutureCow

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?

Schranz0r

DIM are allways global ;)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Moru

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]

S. P. Gardebiter

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)
~ Cave Story rules! ~