Is there any problem with arrays like this[][]?

BlitzMax Forums/BlitzMax Programming/Is there any problem with arrays like this[][]?

JoshK(Posted 2010) [#1]
I am getting a strange memory overwrite error somewhere. Could it be caused by declaring resizable arrays like this?:
Field instancematrix:Float[][MAXVEGETATIONLAYERS]
Field billboardcenter:TVec3[MAXVEGETATIONLAYERS]



Warpy(Posted 2010) [#2]
If it was anyone else asking this, I would've said no.


Htbaa(Posted 2010) [#3]
I don't recall having problems with it.

Question is, what value does MAXVEGETATIONLAYERS contain?


JoshK(Posted 2010) [#4]
It's a constant integer.


Htbaa(Posted 2010) [#5]
Yes I get that, what value does it contain.


JoshK(Posted 2010) [#6]
32


Brucey(Posted 2010) [#7]
Multi-dimensional arrays aren't good.
(I'm not going to back that up with any reasons other than perhaps... I told you so).


JoshK(Posted 2010) [#8]
Multi-dimensional arrays aren't good.

Can you elaborate on that?

I tracked the bug down to an error in Newton physics.


ziggy(Posted 2010) [#9]
Multi-dimensional arrays aren't good.

But isn't JoshK creating a unidimensional array of unidimensional arrays?


Dreamora(Posted 2010) [#10]
Above code shouldn't do any overwrite but the first array also is not really declared / correctly initialized at that point. its just a reference to "nothing" at that time so not much to overwrite.