Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Just a Few Questions
#12
(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.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
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)