-
Notifications
You must be signed in to change notification settings - Fork 544
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
Calling input() at EOF doesn't return EOF character(-1). #548
Comments
Related issue: #540 |
Related issue: #448 |
Related issue: #444 |
This is expected behavior for Posix int input(void) Returns the next character from the input, or zero on end-of-file. It shall obtain input from the stream pointer yyin, although possibly via an intermediate buffer. Thus, once scanning has begun, the effect of altering the value of yyin is undefined. The character read shall be removed from the input stream of the scanner without any processing by the scanner. btw |
Minimal reproducible example:
Expected output:
Actual output:
Explanation:
A) On reading EOF,
input
returns 0 instead of expected -1 (EOF character).B) On reading EOF,
input
callsyyrestart
, which callsyy_init_buffer
, which callsyy_flush_buffer
, which initializes first two bytes ofyy_ch_buf
to 0, which, in this case, clobbersyytext
.The text was updated successfully, but these errors were encountered: