On 2017-01-17 19:45:25 -0600, Derek Martin wrote:
> It might be slightly preferable to change the if block to:
>
> if (!feof(f) && !ferror(f) && ch)
> ungetc(ch, f);
>
> But it makes exactly zero difference. Also:
>
> if (!feof(f) && !ferror(f))
> ungetc(ch, f);
>
> Not clearly better.
The C standard says that either a character (when available) or EOF
is returned. Why not the following?
if (ch != EOF)
ungetc(ch, f);
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)