GLBasic forum

Main forum => GLBasic - en => Topic started by: Moru on 2008-Aug-31

Title: DIMDATA as global
Post by: Moru on 2008-Aug-31
Is it possible to explicitly declare a dimdata array as global?
Title: Re: DIMDATA as global
Post by: Schranz0r on 2008-Sep-01
Code (glbasic) Select
GLOBAL MyArray[]
DIMDATA MYArray[], 0,1,2,3,4,5,6,7,8,9


Thats it.
Title: Re: DIMDATA as global
Post by: peterpan on 2008-Sep-01
Hi SchranzOr,

DIM is always global !
from this it follows that

DIMDATA MYArray[], 0,1,2,3,4,5,6,7,8,9
Title: Re: DIMDATA as global
Post by: Schranz0r on 2008-Sep-14
Quote from: peterpan on 2008-Sep-01
Hi SchranzOr,

DIM is always global !
from this it follows that

DIM MyArray[10]
DIMDATA MYArray[], 0,1,2,3,4,5,6,7,8,9

NO!
turn the debuger on, and read the warning:

warning : implicitly created GLOBAL  : MyArray

Thats true, NOW its global, but thats the wrong way!

! PLS ! use (for global):
Code (glbasic) Select
GLOBAL MyArray[]
DIMDATA MYArray[], 0,1,2,3,4,5,6,7,8,9


and local
Code (glbasic) Select
LOCAL MyArray[]
DIMDATA MYArray[], 0,1,2,3,4,5,6,7,8,9
Title: Re: DIMDATA as global
Post by: Kitty Hello on 2008-Sep-15
edited.
DIMDATA does _not_ need an explicit DIM before. I already know the size, so DIMDATA does DIM + DATA.
Title: Re: DIMDATA as global
Post by: Schranz0r on 2008-Sep-15
ahhhh cool :D