Passing fixed length string array to function
#7
(08-25-2022, 04:16 AM)SMcNeill Wrote: I'm guessing that what you're trying to do with STRING * 8 is just make certain to properly align the data? 




It was for the _MEM sub mainly, which was simply



Code: (Select All)
SUB MemSmush (m AS _MEM, x%) '                                  move array elements above x% down over x%. Fill uppermost with null
    _MEMCOPY m, m.OFFSET + (m.ELEMENTSIZE * (x% + 1)), m.SIZE - (m.ELEMENTSIZE * (x% + 1)) TO m, m.OFFSET + (m.ELEMENTSIZE * x%)
    _MEMFILL m, m.OFFSET + m.ELEMENTSIZE * ((m.SIZE / m.ELEMENTSIZE) - 1), m.ELEMENTSIZE, 0 AS _BYTE
END SUB




Kind of like yankin' a box out from under a stack of boxes. Just that the boxes have to be the same size for the mem commands to work. The whole point of that being to avoid unnecessary iterations to remove and pancake a series of array elements. I tried your "foo" example from earlier as a function and it behaved the same way. It's obvious that the IDE sees AS STRING and AS STRING * 8 as two different types and I just can't do that.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply


Messages In This Thread
RE: Passing fixed length string array to function - by OldMoses - 08-25-2022, 08:03 AM



Users browsing this thread: 5 Guest(s)