Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!helios!archone.tamu.edu From: byron@archone.tamu.edu (Byron Rakitzis) Newsgroups: comp.lang.c Subject: One more point regarding = and == (more flamage) Message-ID: <13603@helios.TAMU.EDU> Date: 22 Mar 91 01:46:32 GMT Sender: usenet@helios.TAMU.EDU Organization: College of Architecture, Texas A&M University. Lines: 25 I have one more thing to say to the self-styled C gods who approve of simple assignments as an implicit test against zero inside an if-statment. It's this: There is no way when you see the code-fragment a) while (*foo++ = *bar++) to tell whether a copy of data in strcpy fashion is intended, or whether this should have been a strcmp-like loop: while (*foo++ == *bar++) One is forced to gather from the context of the program just what the programmer intended. Now in this case, it may be "obvious" what the intent of the programmer is, but I don't think anyone can doubt that the first instance is rendered UNAMBIGUOUS by the addition: 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? What do the coding style people say anyway?