Allow multidimensional arrays in structures

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Franky
Enthusiast
Enthusiast
Posts: 213
Joined: Sat Apr 26, 2003 2:58 pm

Allow multidimensional arrays in structures

Post by Franky »

Hi there,
Title says it all.

Greetings

Franky
Give Up everything but trying!
Franky
Enthusiast
Enthusiast
Posts: 213
Joined: Sat Apr 26, 2003 2:58 pm

Re: Allow multidimensional arrays in structures

Post by Franky »

Sorry for the late answer, it's been a busy time.

What I mean is not static but dynamic Arrays

Code: Select all

Structure MyValues
  Dim Value.l(1,1)
EndStructure
I have 2-dimensional Data of which I don't know the number of rows or columns on compile time, but that I find by loading data from a file (or more; up to 250 MB of Data and more).

For the moment, I'm doing it like this:

Code: Select all

Structure MyInnerValues
  Dim Value.l(1)
EndStructure

Structure MyValues
  Dim Val.MyValues(1)
EndStructure
The problem is, that this is very unoptimized. Having a 2-dimensional Array inside structures would take me ~2 milliseconds for allocating memory and another half second to fill it with the data. The workaround takes me ~2 milliseconds for allocating the firstDimension (Dim Val), half a second to fill in the Data, but nearly 2 Seconds to allocate all the Inner Arrays.

So, it's kind of missing possibility for otimizing my code.

I could work with AllocateMemory and Pointers, but that's ugly, buggy and unreadable.

And another point (not for me, but in many cases happening)

Imagine 2D-Data inside a file (for example a Bitmap).

Code: Select all

Structure Img
  height.l
  width.l
 Dim Pixel.l(0,0)
EndStructure

Global NewList Images.Img()
Would make it possible, to read multiple files by reading ReadData and using these Data inside the Array.

So, to me it seems like an important feature.

Perhaps Freak or Fred could tell something about how hard that would be to implement.

Best Regards

Franky
Give Up everything but trying!
Post Reply