Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!crdgw1!camelback!volpe From: volpe@camelback.crd.ge.com (Christopher R Volpe) Newsgroups: comp.lang.c Subject: Re: One more point regarding = and == (more flamage) Message-ID: <18325@crdgw1.crd.ge.com> Date: 8 Apr 91 13:28:05 GMT References: <925@isgtec.UUCP> <1991Mar26.184245.3538@chinet.chi.il.us> <11563@dog.ee.lbl.gov> <3555@inews.intel.com> <3465@litchi.bbn.com> <1991Apr4.215605.2801@syssoft.com> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@camelback.crd.ge.com (Christopher R Volpe) Lines: 30 In article <1991Apr4.215605.2801@syssoft.com>, tom@syssoft.com (Rodentia) writes: |>In article <3465@litchi.bbn.com> rsalz@bbn.com (Rich Salz) writes: |>>In <3555@inews.intel.com> bhoughto@hopi.intel.com (Blair P. Houghton) writes: |>>>toupper.c: while ( (int) (c = getchar()) != EOF ) |>>The cast implies that c is char. If so, this line is buggy. |> |>Does this mean that there if c is char, there is no way to assign the |>getchar and test it for EOF without having it cast down to char? c simply shouldn't be a char. It should be an int, since that is what getchar returns. getchar can't return a char because it has to return 257 distinct values: all 256 values of char, plus the value EOF. Write it like this: int c; ... while ((c=getchar()) != EOF) {...}; |>Thomas Roden | tom@syssoft.com |>Systems and Software, Inc. | Voice: (714) 833-1700 x454 |>"If the Beagle had sailed here, Darwin would have | FAX: (714) 833-1900 |>come up with a different theory altogether." - me | ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com