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

Input Decimal command fails on EOF and negative numbers #3

Open
j4james opened this issue Feb 16, 2017 · 0 comments
Open

Input Decimal command fails on EOF and negative numbers #3

j4james opened this issue Feb 16, 2017 · 0 comments

Comments

@j4james
Copy link

j4james commented Feb 16, 2017

According to the specification:

In the case of an end-of-file or other file error condition, the & and ~ both act like r.

However, when it comes to the & (Input Decimal) command, FBBI goes into an infinite loop in the case of an end-of-file.

The problem is the loop at the start of the fi_idec function which tries to skip over any non-digits in the input stream. On end-of-file, a digit is never encountered so the loop never ends.

That loop is also responsible for FBBI failing to read negative numbers correctly, because the sign of the number is dropped before it gets to the scanf call.

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

1 participant