is fflush(stdin) legal? the online docs i read all contradict each other.
Printable View
is fflush(stdin) legal? the online docs i read all contradict each other.
> is fflush(stdin) legal?
No.
> the online docs i read all contradict each other
There's only one doc which is worth reading in this respect, and it's the ANSI-C standard.
You can get a free copy of the last C99 draft
here
Since stdin is never going to meet those conditions, fflush(stdin) is always undefined behaviour.Quote:
If stream points to an output stream or an update stream in which the most recent
operation was not input, the fflush function causes any unwritten data for that stream
to be delivered to the host environment to be written to the file; otherwise, the behavior is
undefined.
>But it is one nice topic for people like Prelude to pomp on.
I try to rid the world of undefined behavior, thank you for noticing. :D
-Prelude