Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limits for p operation #33

Open
Jachdich opened this issue Dec 9, 2019 · 4 comments
Open

Limits for p operation #33

Jachdich opened this issue Dec 9, 2019 · 4 comments

Comments

@Jachdich
Copy link

Jachdich commented Dec 9, 2019

It is unclear from what I have read what the limits of the p operation are, e.g. this program:

99*:*66p

Does it store 6561 or whatever (signed char)6561 is?

@j4james
Copy link

j4james commented Dec 9, 2019

The reference interpreter will store the value as a signed char, i.e. -95, but there is a wide variation in behaviour by other interpreters. Some use signed values, some use unsigned, and they can range from 8 bits to unbounded.

@Jachdich
Copy link
Author

Thanks for the clarification. I'm guessing it's not against the specification to use a signed long to store your code? (That's what I've done in my interpreter)

@j4james
Copy link

j4james commented Dec 10, 2019

The specification just refers to the playfield cells as "characters", which leaves some room for interpretation, but a signed long seems a bit of a stretch. Also, speaking as a Befunge programmer, I personally prefer interpreters that match the behaviour of the reference interpreter exactly, since it makes it easier to write portable code.

That said, nobody is going to stop you doing things your own way. Plenty of other interpreters have done the same thing. Just bear in mind that your interpreter may then not be able to run some Befunge code that relies on the reference behaviour. As a compromise, you could always have an option in your interpreter to be more standard compliant.

@Jachdich
Copy link
Author

That's a good idea. I'll add a command line switch to disable all custom features (I've added a few instructions, such as a primitive jump that I'll also disable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants