Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Just a Few Questions
#13
(09-10-2023, 02:47 PM)TerryRitchie Wrote:
(09-10-2023, 01:45 PM)TarotRedhand Wrote: @bplus I doubt using a dynamic array to emulate a true stack will aid with those 2 things, it should be relatively straightforward to implement a faux stack. (a queue and/or a deque on the other hand...). Just need a simple variable to hold the ToS (Top of Stack) and use Redim _Preserve somewhat liberally.

TR
Just curious, where would a stack be handy in QB64 programming?

I created a stack like structure in my Super Megabug game way back in 2010 to store locations of maze endpoints as random mazes are created. But I used a stack structure simply because I was new to QB64 and was familiar with their use when I programmed in Assembler. I could have just as easily used an array.

Perhaps a fixed (static) sized _MEM structure could be used and a stack pointer indicating the current memory location much the same as was done in Assembler. Depending on the pointer use you could create a LIFO or FIFO stack. I think using _REDIM _PRESERVE would be rather slow for something like a stack that is constantly updating.

I use LIFO stacks for return lines from GoSubs in my interpreter and use LIFO stack when converting a recursive routine to a manual routine not using built in recursion of QB64.

@grymmjack I got paged twice by Terry's post above?
b = b + ...
Reply


Messages In This Thread
Just a Few Questions - by TarotRedhand - 09-09-2023, 09:44 AM
RE: Just a Few Questions - by mnrvovrfc - 09-09-2023, 10:14 AM
RE: Just a Few Questions - by bplus - 09-09-2023, 11:20 AM
RE: Just a Few Questions - by SMcNeill - 09-09-2023, 12:19 PM
RE: Just a Few Questions - by bplus - 09-09-2023, 12:42 PM
RE: Just a Few Questions - by mnrvovrfc - 09-09-2023, 01:02 PM
RE: Just a Few Questions - by SMcNeill - 09-09-2023, 02:05 PM
RE: Just a Few Questions - by bplus - 09-09-2023, 02:41 PM
RE: Just a Few Questions - by mnrvovrfc - 09-09-2023, 08:37 PM
RE: Just a Few Questions - by TarotRedhand - 09-10-2023, 07:09 AM
RE: Just a Few Questions - by TarotRedhand - 09-10-2023, 01:45 PM
RE: Just a Few Questions - by TerryRitchie - 09-10-2023, 02:47 PM
RE: Just a Few Questions - by bplus - 09-10-2023, 02:57 PM
RE: Just a Few Questions - by mnrvovrfc - 09-11-2023, 10:58 AM
RE: Just a Few Questions - by TarotRedhand - 09-11-2023, 09:11 AM
RE: Just a Few Questions - by DSMan195276 - 09-11-2023, 12:10 PM



Users browsing this thread: 3 Guest(s)