Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
REDIM takes more resources than DIM?
#22
(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)

[Image: Re-Dim-Co2024-07-17.jpg]
Reply


Messages In This Thread
REDIM takes more resources than DIM? - by bplus - 07-17-2024, 12:21 AM
RE: REDIM takes more resources than DIM? - by Kernelpanic - 07-17-2024, 08:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Preserving multi-dim arrays Pete 5 419 12-19-2025, 03:17 PM
Last Post: Dimster
  packaging resources tool TempodiBasic 6 587 09-22-2025, 11:16 PM
Last Post: TempodiBasic
  DIM AT -- feature request Jack 2 722 08-15-2023, 12:15 AM
Last Post: grymmjack
  REDIM, TYPE, and STRING Woes TerryRitchie 16 3,184 04-13-2023, 05:17 AM
Last Post: DSMan195276
  suggestion: initialize array values within the DIM statement bobalooie 19 3,388 12-22-2022, 06:46 PM
Last Post: Kernelpanic

Forum Jump:


Users browsing this thread: 1 Guest(s)