Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!sics.se!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: 12 Apr 91 00:58:01 GMT References: <1991Apr4.215605.2801@syssoft.com> <1991Apr7.064003.8552@athena.mit.edu> <3043@cirrusl.UUCP> <1991Apr8.222824.24474@athena.mit.edu> Sender: enag@ifi.uio.no (Erik Naggum) Organization: Naggum Software, Oslo, Norway Lines: 18 In-Reply-To: jfc@athena.mit.edu's message of 8 Apr 91 22: 28:24 GMT In article <1991Apr8.222824.24474@athena.mit.edu>, John F Carr writes: In article <3043@cirrusl.UUCP>, Rahul Dhesi writes: >I have always assumed that EOF is guaranteed to be -1. I think there >is enough history behind EOF == -1 (just as with NULL == 0) that it >isn't likely to be anything else. The ANSI standard says EOF is a negative number. It does not have to be -1. If I ever write a C implementation which doesn't need to be binary compatible with an existing UNIX library, I'll make EOF something like -256 to make sure it can never equal a signed or unsigned char value. Traditionally, EOF is -1. I don't know what POSIX says. POSIX.1 points to the C standard and has no further comments on EOF. -- [Erik Naggum] Naggum Software, Oslo, Norway