getc() != EOF
Ed Nather
nather at utastro.UUCP
Sun May 27 12:35:34 AEST 1984
[]
>
>In all conscience,
>
> while ( (c = getc()) != EOF )
>
>ought to work. If somebody is to be blamed, it is surely not the
>people who wrote the code, but the people who made a C implementation
>that broke it.
It will work if "c" is declared "int."
It will not work if "c" is declared "char."
Variable declarations are an essential part of the program, and should be
included in illustrative code fragments, so problems are not concealed.
Grumph.
--
Ed Nather
{allegra,ihnp4}!{ut-sally,noao}!utastro!nather
Astronomy Dept., U. of Texas, Austin
More information about the Comp.unix.wizards
mailing list