Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Atomic #defines (was Re: Password checking program) Message-ID: <10856@smoke.BRL.MIL> Date: 28 Aug 89 14:02:49 GMT References: <15257@duke.cs.duke.edu> <652@lakart.UUCP> <10765@smoke.BRL.MIL> <1625@mcgill-vision.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20 In article <1625@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >In article <10765@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes: >> EOF belongs to the C implementation. Invent your own symbols for >> your own uses. >Fine. But how? #include #define MY_EOF (-1234) /* presumably in some local header */ #define MY_ERR (-4321) int MyGetChar() { int c; return (c = getchar()) == EOF ? ferror(stdin) ? MY_ERR : MY_EOF : c; } >By the way, it seems to me that the required existence of EOF implies >that it is not a legal implementation choice to make char and int >identical. Is this true? Since in such an implementation an int would be unable to represent all possible values in the range of a unsigned char, as required by the specification for some library routines, it would not be standard conforming.