Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site proper.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!hao!hplabs!hpda!fortune!amd70!dual!proper!gam From: gam@proper.UUCP (Gordon Moffett) Newsgroups: net.unix-wizards Subject: Re: getc() != EOF Message-ID: <1315@proper.UUCP> Date: Wed, 6-Jun-84 22:48:00 EDT Article-I.D.: proper.1315 Posted: Wed Jun 6 22:48:00 1984 Date-Received: Sat, 9-Jun-84 08:34:58 EDT References: <1970@rlgvax.UUCP>, <91@ncoast.UUCP> Organization: Proper UNIX, Oakland, CA Lines: 16 From: bsafw@ncoast.UUCP Brandon Allbery Organization: North Coast XENIX, Cleveland > The local "lint" tells me that ((ch = getc ()) != EOF) is illegal on > IBM-based Cs. This fits in with the (assumption) that an IBM/370 C would use > EBCDIC, NOT ASCII, and all 8 bits of the character data are significant, so No, no, no! It has nothing to do with EBCDIC; the comparison fails because EOF is explicitly OUTSIDE of the underlying character set, WHATEVER IT HAPPENS TO BE. It is exactly (int)-1, and not (char)-1. Amdahl's UTS (v7 and Sys V) runs on 370's and uses ascii anyway, but the chars are unsigned, and that is why any comparison of a character to -1 (EOF) is always false ... and that is where this discussion started most recently (and I think its been beaten to death now ...).