03-21-2025, 08:33 PM
(03-21-2025, 07:11 PM)Unseen Machine Wrote: Version 1.8 over here....and yeah works fine for me.....which In my mind means i t SHOULD work fine for anyone using later versions of Qb64 or is legacy support no longer a thing?
Thanks for trying it though. I will get the latest version of QB and see what i can surmise.
Unseen
2.0 made some breaking changes to QB64 with the way FUNCTION worked and all, especially with recursive calls. We branched off v2.0.2, so all of our versions should run anything 2.0 and above, but since 2.0 broke other prior versions, you'll need to make some modifications to the code to adapt for that.
Let me highlight a quick example of the issue:
FUNCTION foo (x)
foo = RND * 100
foo = foo + x
END FUNCTION
That used to be perfectly valid before version 2.0. The first line assigns a random number to foo. The second line looks up that number and adds x to it. All fine and happy and roses.... <--- This is similar to your current code.
V 2.0 came along and actually *fixed* an issue with recursion.
That second line in version 2.0+?? It now sees that foo on the right side of that equal bar and... CALLS THE FUNCTION AGAIN. Which will... call it again... and again... and again.. and again... and... how big is your stack space? You just broke it!!
So what's the fix??
Remove it from the right side of the equal bar.
FUNCTION foo (x)
temp_foo = RND * 100
temp_foo = temp_foo + x
foo = temp_foo
END FUNCTION
No calls to foo in there. Just the one assignment at the last line of code. No recursive calls, no problemo.
(And you could skip that step with the line above by making that (foo = temp_foo + x). I was just highlighting the fix for you.)
That's the basic reason for the version change from 1.X to 2.X.
We changed from 2.X to 3.X when swapping over to QB64 Phoenix Edition, to show we were different from the previous guys stuff and branched forward from there.
We changed from 3.X to 4.X when depreciating $NOPREFIX. (Though we did toss in a built-in auto-convertor so old code should still load and run with it, without having to make changes.
But that's basically the history of where you sit now, compared to where things sat back at v1.8 ages ago.
