Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jfc From: jfc@athena.mit.edu (John F Carr) Newsgroups: comp.lang.c Subject: Re: getchar and EOF (was: One more point regarding = and == (more flamage)) Message-ID: <1991Apr8.222824.24474@athena.mit.edu> Date: 8 Apr 91 22:28:24 GMT References: <1991Apr4.215605.2801@syssoft.com> <1991Apr7.064003.8552@athena.mit.edu> <3043@cirrusl.UUCP> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 15 In article <3043@cirrusl.UUCP> dhesi%cirrusl@oliveb.ATC.olivetti.com (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. -- John Carr (jfc@athena.mit.edu)