Sorry for the delay. I use version 15.08.11, the first one I ever installed. I've just tried the code, and now it works. It's really strange, because It failed the other day, and I tried it several times in new sessions of the emulator, in order to be sure. I'll try to discover what happened. Thanks.
Update: I forgot I used version 15.08.10 first and upgraded it on 2016-12-09, but the problem arised days later, with version 15.08.11.
Last edit: Marcos Cruz 2016-12-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Marcos, thanks for letting me know. Unfortunately it can be hard to reproduce bugs with an interpreter, because it stores so much internal state - it may be that the bug gets triggered if certain variables exist, etc.
In case it helps, the Out of Memory error is thrown by FN calls if the function is recursive: there is no way to terminate recursion in a one-line function, since GW-BASIC does not have a ternary operator; hence the call stack just keeps growing until it uses up all memory. PC-BASIC signals this condition early and throws the error right away when a function cals itself recursively. Perhaps it throws it in error if A% already exists as a variable, or something similar. I'll have to play around a bit to see if there is a problem there.
Cheers
Rob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In case it helps, the Out of Memory error is thrown by FN calls if the function is recursive: there is no way to terminate recursion in a one-line function, since GW-BASIC does not have a ternary operator; hence the call stack just keeps growing until it uses up all memory. PC-BASIC signals this condition early and throws the error right away when a function cals itself recursively. Perhaps it throws it in error if A% already exists as a variable, or something similar.
Thanks. That was exactly what I was going to ask you! I can confirm the error happens during the excecution of a program of mine I'm porting from other dialect of BASIC. I'm trying to isolate the error conditions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just installed 15.08.11 for the first time today. I had a similar problem with a single precision function that I wrote. I hadn't saved the file yet. After reading this forum, I simply saved, closed PC-BASIC, re-launched, reloaded my program, and it magically worked. It's a very short test program that simply defines a function and calls it. There's definitely no recursion there, and the same code worked after restarting PC-Basic.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have found out this problem:
This happens when the "%" suffix is used ("!" and "#" work fine). I have tried the same code in the original interpreter on DOSBox, and it works.
Hi, thanks for reporting, I'll investigate. Which version of PC-BASIC were you using?
Thanks
Rob
Hi Marcos, sorry, I can't reproduce with version 15.08.11 or with 16.12.0rc0. The above code gives me
100
as I would expect.
If you're using an older version, could you please update and try if the issue still exists?
Thanks
Rob
Sorry for the delay. I use version 15.08.11, the first one I ever installed. I've just tried the code, and now it works. It's really strange, because It failed the other day, and I tried it several times in new sessions of the emulator, in order to be sure. I'll try to discover what happened. Thanks.
Update: I forgot I used version 15.08.10 first and upgraded it on 2016-12-09, but the problem arised days later, with version 15.08.11.
Last edit: Marcos Cruz 2016-12-27
Hi Marcos, thanks for letting me know. Unfortunately it can be hard to reproduce bugs with an interpreter, because it stores so much internal state - it may be that the bug gets triggered if certain variables exist, etc.
In case it helps, the
Out of Memory
error is thrown byFN
calls if the function is recursive: there is no way to terminate recursion in a one-line function, since GW-BASIC does not have a ternary operator; hence the call stack just keeps growing until it uses up all memory. PC-BASIC signals this condition early and throws the error right away when a function cals itself recursively. Perhaps it throws it in error ifA%
already exists as a variable, or something similar. I'll have to play around a bit to see if there is a problem there.Cheers
Rob
Thanks. That was exactly what I was going to ask you! I can confirm the error happens during the excecution of a program of mine I'm porting from other dialect of BASIC. I'm trying to isolate the error conditions.
View and moderate all "[CLOSED] Bug reports" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I just installed 15.08.11 for the first time today. I had a similar problem with a single precision function that I wrote. I hadn't saved the file yet. After reading this forum, I simply saved, closed PC-BASIC, re-launched, reloaded my program, and it magically worked. It's a very short test program that simply defines a function and calls it. There's definitely no recursion there, and the same code worked after restarting PC-Basic.
Bug tracker here https://github.com/robhagemans/pcbasic/issues/19