12-06-2022, 07:12 AM
A few foos too many in my examples... LOL! Once they start, and copy-paste hits, they never stop!
FUNCTION foo
IF junk < 10 THEN foo = foo OR 1
IF junk >9 AND foo < 100 then foo = foo OR 2
IF junk > 99 and foo < 1000 THEN foo = foo OR 4
Those two foos in red should've been junk instead, and junk, of course, would probably be best as SHARED junk, so you at least have a value with it to work with...
What can I say? It's after-midnight coding at its most honest!
The point of the way old code worked, "foo = foo OR 1" <-- here this was both references to the variable named foo, which held our return value. After the fix, the one on the left was the variable; the one on the right became a recursive function call.
And that ended up breaking a lot of old code. (Now folks will argue that it was "BADLY WRITTEN CODE", but that's debatable. If it worked as the programmer intended, because that was an allowable syntax to the language, then how could it be badly written? Only code that doesn't work, or that works but gives the wrong results, can be called badly written.) Be what it may, it *used* to work, but after the "fix" to recursion, it didn't anymore.
And we still have folks pop up on the forums or in the discord asking why their old stuff no longer works on newer versions of QB64 because of it. But, at this point, what can one say except, "It is what it is."
FUNCTION foo
IF junk < 10 THEN foo = foo OR 1
IF junk >9 AND foo < 100 then foo = foo OR 2
IF junk > 99 and foo < 1000 THEN foo = foo OR 4
Those two foos in red should've been junk instead, and junk, of course, would probably be best as SHARED junk, so you at least have a value with it to work with...
What can I say? It's after-midnight coding at its most honest!
The point of the way old code worked, "foo = foo OR 1" <-- here this was both references to the variable named foo, which held our return value. After the fix, the one on the left was the variable; the one on the right became a recursive function call.
And that ended up breaking a lot of old code. (Now folks will argue that it was "BADLY WRITTEN CODE", but that's debatable. If it worked as the programmer intended, because that was an allowable syntax to the language, then how could it be badly written? Only code that doesn't work, or that works but gives the wrong results, can be called badly written.) Be what it may, it *used* to work, but after the "fix" to recursion, it didn't anymore.
And we still have folks pop up on the forums or in the discord asking why their old stuff no longer works on newer versions of QB64 because of it. But, at this point, what can one say except, "It is what it is."