Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!mcnc!ecsvax!bet From: bet@ecsvax.UUCP Newsgroups: net.lang.c Subject: Re: if((c=getchar())!=EOF) Message-ID: <2618@ecsvax.UUCP> Date: Wed, 30-May-84 12:28:04 EDT Article-I.D.: ecsvax.2618 Posted: Wed May 30 12:28:04 1984 Date-Received: Fri, 1-Jun-84 07:53:42 EDT Lines: 9 As has been said, "if((c=getchar())!=EOF)" is perfectly valid IFF "c" is declared "int"; NOT if c is a char. Whether char variables are signed or unsigned, for purposes of comparison or promotion to integer, is explicitly undefined in C [ref K&R p. 40, p. 183]. This is established and documented. It is an instance in which the definition of the language is explicitly ambiguous to allow whatever implementation is more efficient on a particular machine. Bennett Todd ...{decvax,ihnp4,akgua}!mcnc!ecsvax!bet