Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!rpi!uupsi!sunic!ugle.unit.no!nuug!ifi!enag From: enag@ifi.uio.no (Erik Naggum) Newsgroups: comp.lang.c Subject: Re: getchar and EOF (was: One more point regarding = and == (more flamage)) Message-ID: Date: 7 Apr 91 19:50:47 GMT References: <3555@inews.intel.com> <3465@litchi.bbn.com> <1991Apr4.215605.2801@syssoft.com> <1991Apr7.064003.8552@athena.mit.edu> Sender: enag@ifi.uio.no (Erik Naggum) Organization: Naggum Software, Oslo, Norway Lines: 25 In-Reply-To: scs@adam.mit.edu's message of 7 Apr 91 06:40:03 GMT In article <1991Apr7.064003.8552@athena.mit.edu>, Steve Summit writes: >[note 1] As a return value from getchar, EOF is guaranteed to >be distinct from all char values. This is because getchar >essentially returns (as the ANSI C standard explicitly requires >it to; see sec. 4.9.7.1) normal characters as unsigned characters >cast to int (i.e. as positive values, even on a machine on which >chars are usually signed), while EOF is always a negative value. >I was going to say that "EOF is guaranteed not to compare equal >to any char value," but this is not really true. It is interesting to note that Unicode, one of the proposed new character sets with "universal" scope and coverage, with its 16-bit characters has recognized the value of EOF (-1) to applications and programmers alike, and states Not a character code FFFF This 16-bit value is guaranteed not to be any Unicode character at all -- [Erik Naggum] Naggum Software, Oslo, Norway