Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
suggestion: initialize array values within the DIM statement
#18
An extra element is being allocated. I know "(1 TO 1)" is extra typing but I prefer it.

This time I said nothing about "OPTION BASE" because the way I suggested in my code to declare an array makes "OPTION BASE" useless. Each one to his/her own.

What if you needed to use "_MEM" on that "ARRAY(0)" thing, gave nothing to that zeroth-subscript element and you expected the opposite? Instead you have to use "LEN" to figure out the size of UDT variable, and something remembered such as 8 for _INTEGER64, and give up that "_MEM-variable-dot-OFFSET" as your first element. If you create such an array where you think you have five elements and then "_MEMCOPY" only five elements, at offset zero, the "ARRAY(5)" becomes undefined.

Disregard that plea if you're hardcore about QuickBASIC and QBasic, and about QB64 before v0.95.
Reply


Messages In This Thread
RE: suggestion: initialize array values within the DIM statement - by mnrvovrfc - 12-21-2022, 11:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Preserving multi-dim arrays Pete 5 439 12-19-2025, 03:17 PM
Last Post: Dimster
  Arbitrary CONST values Unseen Machine 31 2,978 10-29-2025, 05:44 AM
Last Post: bplus
  Array out of passing arrays... Pete 2 417 09-22-2025, 08:53 PM
Last Post: ahenry3068
  Huge array of variable length strings mdijkens 9 1,877 10-17-2024, 02:01 PM
Last Post: mdijkens
  An Array v's A Dictionary Dimster 10 1,924 10-08-2024, 06:59 PM
Last Post: TempodiBasic

Forum Jump:


Users browsing this thread: 1 Guest(s)