After some investigation, I can confirm something strange happens with functions. It seems it's not related only to integer functions or recursion, as it seemed at first. Look:
print fnz$(0)
Undefined user function
Ok
print fnz$(0)
Out of memory
Ok
The print commands were typed right after the boot of PC-BASIC 15.08.11. I typed the same code in the original GW-BASIC 3.23, and the second error is "Undefined user function" as expected.
What do you think?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Marcos, thanks for working this out! I think I know what's going on - PC-BASIC keeps track of what FN functions are being evaluated to be able to cut recursive calls short; it looks like that flag fails to get cleared if the function doesn't actually exist. That would be easy to fix - I'll check if this is the case.
Rob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After some investigation, I can confirm something strange happens with functions. It seems it's not related only to integer functions or recursion, as it seemed at first. Look:
The print commands were typed right after the boot of PC-BASIC 15.08.11. I typed the same code in the original GW-BASIC 3.23, and the second error is "Undefined user function" as expected.
What do you think?
Hi Marcos, thanks for working this out! I think I know what's going on - PC-BASIC keeps track of what FN functions are being evaluated to be able to cut recursive calls short; it looks like that flag fails to get cleared if the function doesn't actually exist. That would be easy to fix - I'll check if this is the case.
Rob
Bug tracker here https://github.com/robhagemans/pcbasic/issues/19