Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Var Initializing is driving me mad..
#1
Code:
dim a(10) as string => {"cero","uno","dos","tres","cuatro","cinco","seis","siete","ocho","nueve","diez"}
[code]

gives
[code]
error26:invalid data types, found  ','

What I'm doing wrong?
Antoni
Reply
#2
It works if you use STRING*6 instead of STRING
ean Debord
----------------
Math library for FreeBasic:
http://www.unilim.fr/pages_perso/jean.de...fbmath.zip
Reply
#3
Thanks!
Antoni
Reply
#4
Yeah, dynamic strings or arrays are not supported, unless if local.
Reply
#5
any chance that you'll add these:

dim i() as integer = {1, 345, 23} 'would dimension automatically.
and initing non constants? like: dim j = somevar or myfunction()

? would be really kwel, thoo I guess it's not as easy to add...

oh and init values in type like:
type i
j as integer = 10
m as string = "Hoho"
end type

and


dim s as mytype
s = { ... }
or *s = {...} if pointer?

That would really rock
url]http://fbide.sourceforge.net/[/url]
Reply
#6
dim foo() = would be cool but can't be done because the ambiguities, "dim foo() as something" is a valid construction and the array foo will be defined as dynamic, that can't be initialized unless if local.

The only way to use non-constants is if the initializing is done at run-time, ie, if the vars are local and not static. dim foo = bar() is valid if foo is a local var though.

Field types w/ initializers would slow down parsing of big include files like the Windows API and would create yet another quirks if people try to allocate the UDT's that contain strings or such as static or at module-level.

foo = { } is usually done by languages that don't have initializers, like for PB's SET, i don't think it will be useful and could be dangerous with arrays passed by descriptor or with pointers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)