As for EOF it is 0xFF which is not always -1,
depending if your char is signed or unsigned.
Ha! You fell into my trap! getc() returns an int! (I
don't know if EOF is _always_ "all bits set", and even if it
is, that's only -1 on a twos-complement machine, if we want
to head off into some real pedantry...)
The need to use feof() and ferror() at least appear in
the BUGS section on my Mac. Linux is not so gracious. The
real bug, if you ask me, which no one did, is that getc()
and pals return an int rather than a char, which is
surprising and certainly has tripped me up several times
across the decades (and yes, I understand that since any
character value is a legal character to have gotten, you
need some other way of signalling an error).