Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!think!think.com!barmar From: barmar@think.com Newsgroups: comp.lang.c Subject: Re: A question of style Message-ID: <31884@news.Think.COM> Date: 1 Dec 89 20:03:36 GMT References: <547@mars.Morgan.COM> <1989Nov30.001947.14883@aqdata.uucp> <427@jhereg.Minnetech.MN.ORG> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA Lines: 18 I hope you're prepared for a flood of followups (I know *I've* gotten them when I've goofed like this).... In article <427@jhereg.Minnetech.MN.ORG> mark@jhereg.minnetech.mn.org (Mark H. Colburn) writes: >The code above could be written as > while (c = getchar && c != EOF) { >Which most programmers would find "more intuitive" than the comma seperated >one. Except, of course, that it is *not* equivalent (and I'm ignoring the missing parentheses after "getchar"). In the comma-separated version the loop only ends when getchar() returns EOF. Your version terminates the loop when getchar() returns either 0 (e.g. if the user types Control-@) or EOF. Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar