![]() |
Question about _MEM blocks and arrays - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Question about _MEM blocks and arrays (/showthread.php?tid=3730) Pages:
1
2
|
RE: Question about _MEM blocks and arrays - madscijr - 06-04-2025 (06-04-2025, 04:21 PM)SMcNeill Wrote: A practical use for mem? My question is, can't we update the compiler to be a little smarter, and generate code that uses these direct memory manipulation tricks, for commands like array(index)? RE: Question about _MEM blocks and arrays - Jack - 06-05-2025 a simple example to copy an array Code: (Select All)
RE: Question about _MEM blocks and arrays - FCS_coder - 06-06-2025 The motivation for me was the ability to do array processing on dynamicall sized blobs of data. I wanted to use MEM blocks the same way Pascal lets you allocate arbitrary sized records by using either arrays or pointers to char/byte lists. I want to have a record/struct ocontaining a status byte, a size allocated byte, plus the dara. Thinking about it I realized I can bump the data up by two bytes/words and just offset the data by that much. That means I can just pass arrays to/from SUBs/PROCs as needed. I was led to that by the info that you can't (shouldn't?) use arrays in UDTs. How good is the heap tracking on REDIMed arrays? Do I nee to worry about fragmentation right away? Not sure how smart the back-end C compiler's memory anagementt library is. RE: Question about _MEM blocks and arrays - madscijr - 06-06-2025 You know what would be very helpful, would be a mini-tutorial series showing all the different common tasks in QB64PE that can be done a lot faster with memory operations, with a simple example of the standard QB64PE method of doing the thing, alongside the memory manipulation method, and an explanation. Then we would have a nice and easy reference to work from all in one place... RE: Question about _MEM blocks and arrays - Jack - 06-06-2025 it might also be helpful to have side-by-side comparison showing C pointers vs QB64 _Mem methods RE: Question about _MEM blocks and arrays - Kernelpanic - 06-06-2025 Quote:@FCS_coder - I was led to that by the info that you can't (shouldn't?) use arrays in UDTs.That is true, but you can use record arrays. Maybe this is a possibility. PS: Bug fixed. But the loop isn't perfect yet. Code: (Select All)
The loop doesn't work. ![]() ![]() |