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



Users browsing this thread: 9 Guest(s)