Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: One more point regarding = and == (more flamage) Message-ID: <1991Mar22.173037.26641@zoo.toronto.edu> Date: Fri, 22 Mar 1991 17:30:37 GMT References: <13603@helios.TAMU.EDU> Organization: U of Toronto Zoology In article <13603@helios.TAMU.EDU> byron@archone.tamu.edu (Byron Rakitzis) writes: >a) while (*foo++ = *bar++) >b) while ((*foo++ = *bar++) != 0) > >All I can say is, if you code in style (a) rather than style (b), don't >expect anyone reading your code to enjoy the experience. > >Henry, are you behind me on this one? ... Yes. Deliberately using a construct that looks like a well-known and subtle programming error is a mistake. Your successor, reading your code, should *never* have to ask himself "is this really right?"; if there is reason for doubt, either comment the code or change it. For that matter, my personal opinion is that relying on C's implicit comparison against zero in conditionals is usually a mistake, barring one or two special cases like variables that are deliberately used only as booleans. That's a broader and more debatable point, though. -- "[Some people] positively *wish* to | Henry Spencer @ U of Toronto Zoology believe ill of the modern world."-R.Peto| henry@zoo.toronto.edu utzoo!henry