Another Array bug.

Archives Forums/Blitz3D Bug Reports/Another Array bug.

Fernhout(Posted 2010) [#1]
I read the help hou to make a Dim of one array
According to the manual you dim on the following way:

 Dim Arr(100)    OR
Dim Arr[100]



so i was writing a source with a fixed array and using

 Dim Arr[100]

but geuse what. I get an error during compiling. The following error come up:
Expecting "("
why is the manual saying you can use it but the compiler says no?

This error came up by accedent normal i use the LOCAL or GLOBAL command. But in this case i used the dim statment.

So my question is is the manual wrong or the compiler.


Floyd(Posted 2010) [#2]
So my question is is the manual wrong or the compiler.

The manual is wrong if it says you can use Dim Arr[100], but I don't know where it says that.


Serpent(Posted 2010) [#3]
Square brackets indicate another type of array - I thought the manual makes it clear, I'm not sure where it would say otherwise. Anyway, this array with square brackets is a 'blitz array' if I remember correctly from the documentation. To declare a normal 'Dimmed' array you use:
Dim Array(9)

But to declare a 'blitz array' you use a local or global statement like a normal variable:
Global Array[9]

So you would be getting the error because the compiler expects the 'Dimmed' array to use round brackets not square brackets.


Dreamora(Posted 2010) [#4]
Right, [] arrays are Blitz Arrays and are normally used in types only (where you can't use dim arrays). The problem with them is that they can not be defined at a flexible size or alike nor can you resize them.


Fernhout(Posted 2010) [#5]
Thanks for the reply guys.
I can understand now the why and how to use it. Ist a shame that this part is not realy good documented. But as you read the manual good the awnser is there only not direct. Its good to know there are people out there who know the awnsers.
See my new problem on equasion by not using the IF statment.