12-31-2022, 12:41 AM
Thanks for the explanation, I was wondering why it wasn't working like I thought it would. As for ending quickly... it didn't, over 8 minutes in it was still going but I got bored and stopped it.
Coverting GOSUB to GOTO?
|
12-31-2022, 12:41 AM
Thanks for the explanation, I was wondering why it wasn't working like I thought it would. As for ending quickly... it didn't, over 8 minutes in it was still going but I got bored and stopped it.
12-31-2022, 02:18 AM
What are you trying to do with that code? Why does one line in the code have no line number?
Maybe the thread title should be "Convert GOTO to GOSUB so my program dies". (shrugs) If "GOSUB" is used that way, why not at least keep track of the number of times it was called, and add a condition so it jumps out of the loop and then calls "RETURN" an equal amount of times? One operation or the other should have a purpose. There's no opportunity even to use "FakeReturn" stunt that Purebasic has, which must be used if "RETURN" is followed by a line label. Which is supposed to prevent either the stack overflow of 16-bit legacy or the chewing up of RAM that is becoming too common in 64-bit systems. I'm not in the mood to request it for QB64PE.
12-31-2022, 12:35 PM
Sub in two modes:
Code: (Select All) x = 1: flag = 0: GoSub Multip
Why not yes ?
(12-30-2022, 11:41 PM)SMcNeill Wrote: And for those curious about what's going on here, here's how we do GOUBS: Glad to see this explanation too! but I can't tell if this code has found a RETURN place or not. If NOT it's still Not an error because you can end programs in subroutines but if you couldn't, it probably should be an error like having a SELECT CASE without an END SELECT or a SUB without an END SUB. Update: After running for over 10 minutes the MB's of Memory being used by the little program jumped from 300's to 1,100's and crept up from there. So I can confirm a memory leak, it just takes awhile to kick in.
b = b + ...
12-31-2022, 07:13 PM
(12-31-2022, 02:18 AM)mnrvovrfc Wrote: What are you trying to do with that code? Why does one line in the code have no line number? Really just seeing what would happen with the code and wondered what was actually going on when several minutes in the program was still running. I figured I'd hit a stack overflow but when I didn't I wondered if the complier was dealing with GOSUB as I believed it was.
12-31-2022, 07:19 PM
(12-31-2022, 06:26 PM)bplus Wrote: Glad to see this explanation too! but I can't tell if this code has found a RETURN place or not. If NOT it's still Not an error because you can end programs in subroutines but if you couldn't, it probably should be an error like having a SELECT CASE without an END SELECT or a SUB without an END SUB. No return in that code. If there was a RETURN in the qb64 code, the translation would be something simple like a goto RETURN_1; |
« Next Oldest | Next Newest »
|