-
Notifications
You must be signed in to change notification settings - Fork 12
Description
References:
- Befunge-93 cells were not unsigned, contrary to what the Funge-98 specification states.
- Several examples that don't appear to work are due to the fact that they assume the interpreter uses unsigned char for playfield cells.
- When I audited compilability I should have checked what char signedness each of those compilers assumes. I plan to do that as part of this issue, using this program, which appears to do the right thing with
gccandgcc -funsigned-char:
#include <stdio.h>
int main(int argc, char **argv) {
char a = (char)127;
char b = (char)127 + (char)1;
if (a > b) {
printf("char is signed char\n");
} else {
printf("char is unsigned char\n");
}
return 0;
}@j4james If you could check the version of MSVC you used with this too, that would be lovely.
As for what to do about it: I don't plan to do anything officially - at the end of the day, signedness of playfield cells in Befunge-93 is just as undefined as signedness of char in C. It's not a great situation for real software engineering, but this isn't real software engineering (cockamamie is our watchword!) and it's been like this for 25 years so why switch horses now?
In practice, if you have a Befunge-93 program that relies on it, you can test it just like the C program tests it (use ` and branch - in fact I think I'll write a Befunge-93 example program that does just that, to demonstrate). Granted, that uses up precious playfield space, so you can just document that it relies on it instead.
In essence there are two minor variations of the language, "Befunge-93 with signed playfield cells" and "Befunge-93 with unsigned playfield cells", which co-exist. Some programs are polyglots that run the same in either variant. Some aren't.
But I would like to do more research on it, and possibly document it somehow, because if there is a distinct bias towards a particular signedness out in the wild (catseye/Funge-98#2 argues the bias is towards signed), it won't hurt to raise attention to it as a potential de facto standard. This will also help contextualize what some example programs do / are supposed to do, in #20.