-
Notifications
You must be signed in to change notification settings - Fork 2
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
Entering any code that outputs causes a crash #2
Comments
Erroneous code probably in |
https://github.com/MineRobber9000/bf3ds/blob/master/src/bf.c#L29 strcat concatinates a string to another string, not a character to a string. Moreover, I believe the behavior is supposed to be that you print each character as they arrive, so that you can print a dialog requesting something for input, and then request input... As it stands it'll only print output when it returns. I'd reccomend using EDIT 2: Even bigger issue, even if strcat worked how you thought it did... you are not initializing Finally, unrelated to the actual issue, I feel this would be better served by a switch statement with a default clause that does nothing. Up to you, of course. EDIT: You are also not initializing the tape to 0, so there might be any junk there. |
Answering your questions and remarks:
I didn't catch these, thanks.
https://github.com/MineRobber9000/bf3ds/blob/master/src/bf.c#L11 Maybe I should change |
This does not initialize output. It declares it, and allocates a 4 byte vaule on the stack.
Once again, I do not reccomend returning the output. |
I'm not implementing input. I thought it over when I began the project and decided it just isn't worth it. I would have to implement a touchscreen keyboard for the input (as you're only allowed to input 1 character) and it would take too much work. Besides, the point of Brainfuck is to be challenging, right? 😃 |
Heh. You could queue up input characters. But I see what you're going for, I guess. Good luck. |
Allocates a buffer for output and initializes it to 0. Change the appending method to use strncat of length 1 which should provide similar results while ensuring we pass in valid input. Have not tested
Any code that isn't supposed to output outputs a gender symbol.
The text was updated successfully, but these errors were encountered: