Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!umd5!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <6059@brl-smoke.ARPA> Date: Sun, 5-Jul-87 16:17:36 EDT Article-I.D.: brl-smok.6059 Posted: Sun Jul 5 16:17:36 1987 Date-Received: Sun, 5-Jul-87 22:42:55 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <22635@sun.uucp> <262@auvax.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 23 In article <262@auvax.UUCP> rwa@auvax.UUCP (Ross Alexander) writes: >In article <22635@sun.uucp>, guy%gorodish@Sun.COM (Guy Harris) writes: >> "getchar" >> will return EOF when it hits end-of-file; EOF (-1) will get converted >> to '\377' ... which compares equal to 255 but not to -1. >Isn't there a little room here for arguement? No, of course not (:-)). The semantics of the expression in question are well understood to agree with Guy Harris's explanation and in fact the forthcoming ANS for C will back him up on this. >the VAX 4.2bsd cc agrees with me... ? The most buggy of the generally-used C compilers, eh? >whilst the SUN 4.2 cc feels otherwise... Is Sun up to SunOS Release 4.2 already? All the argument for your "intuition" of what should happen is beside the point -- there are regular semantics for C expressions, and no legitimate compiler should circumvent them. The whole point of specifications and standards is to define exactly what the rules are.