Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Possibly Related Threads…
Thread Author Replies Views Last Post
Star Suggestion for new REPLACE$() function zaadstra 3 261 01-26-2026, 05:11 PM
Last Post: grymmjack
Question Experimenting with a "StringList" type for simpler handling of string arrays/lists Heimdall 18 1,225 12-19-2025, 12:51 PM
Last Post: Heimdall
  Is there a menu function? Mad Axeman 17 1,090 12-17-2025, 04:43 AM
Last Post: SMcNeill
  Sub not Reconizing Dim as String pmackay 18 1,476 10-16-2025, 03:32 PM
Last Post: pmackay
  getting the number of dimensions in an array on the fly? madscijr 7 743 09-16-2025, 12:34 AM
Last Post: madscijr

Forum Jump:


Users browsing this thread: 1 Guest(s)