07-17-2024, 08:12 PM
(07-17-2024, 06:59 PM)DSMan195276 Wrote: QB64 currently allocates both regular and dynamic arrays at runtime and on the heap (never on the stack). As far as QB64 programs are concerned this distinction doesn't matter, but it does mean that if you use `ReDim` to initially declare an array (and do not resize it later) then it's functionally no different from one declared via `Dim`. I'm pretty confident this is what Luke was getting at if/when he mentioned that you could replace `Dim` with `ReDim` with no penalty.There are problems here, but why? Personally, I think it is wrong to declare an array with ReDim... that is confusing. For me, the clear line is lost.
Code: (Select All)
Option Base 1
ReDim As Integer feld(5, 5)
feld(1, 2) = 3
Print feld(1, 2)
ReDim feld(4, 7)
feld(3, 5) = 12
Print feld(3, 5)
Print: Print
Dim As Integer feld2(6, 8)
feld2(4, 1) = 10
Print feld2(4, 1)
ReDim feld2(9, 9)
feld2(8, 9) = 22
Print feld2(8, 9)

