Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uakari.primate.wisc.edu!indri!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: use of if (!cptr) and if (cptr) && a programming error Message-ID: <10643@smoke.BRL.MIL> Date: 1 Aug 89 21:19:36 GMT References: <10099@mpx2.mpx.com> <93@microsoft.UUCP> <10100@mpx2.mpx.com> <2990@nmtsun.nmt.edu> <18677@mimsy.UUCP> <10592@riks.csl.sony.JUNET> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 7 In article <10592@riks.csl.sony.JUNET> diamond@riks. (Norman Diamond) writes: >But! What about the following famous idiom! > while ((ch = getchar()) != EOF) { ... } >The old value of ch might be compared to EOF? No -- however, EOF may be evaluated before ch is set to what getchar() returns (before the comparison of the new value of ch against EOF).