Author Topic: dimming global arrays  (Read 2489 times)

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
dimming global arrays
« 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]

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: dimming global arrays
« Reply #1 on: 2009-May-29 »
Code: GLBasic [Select]
global dim myarray[20]

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

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Re: dimming global arrays
« Reply #2 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?

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: dimming global arrays
« Reply #3 on: 2009-May-29 »
DIM are allways global ;)
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1772
    • View Profile
    • Homepage
Re: dimming global arrays
« Reply #4 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]

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
Re: dimming global arrays
« Reply #5 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)
~ Cave Story rules! ~