[Implemented] Arrays of any size inside structs

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

[Implemented] Arrays of any size inside structs

Post by Justin »

some api calls fill structures with a pointer to an array of variable size, so being able to do this would be useful

Code: Select all

assuming the array is of longs

structure st
 *a.LONG[]
endstructure

then you pick up values,

var.st
x = var\a[100]\l

now you have to declare a structure with an array pointer larger enough, without really knowing how big can be the array

structure ALONG
  el.LONG[500]
endstructure

structure st
 *a.ALONG
endstructure

x = var\a\el[100]\l
or being able to declare arrays of any dimension from memory blocks anywhere in the code

Code: Select all

*a.SOMESTRUCT[10, 10] = allocatememory(sizeof(SOMESTRUCT)*100)