Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!samsung!spool.mu.edu!news.cs.indiana.edu!cs.widener.edu!sven From: sven@cs.widener.edu (Sven Heinicke) Newsgroups: comp.lang.c Subject: Re: using "=" in a conditional (was Funny Mistake) Message-ID: <1991Mar21.014619.27403@cs.widener.edu> Date: 21 Mar 91 01:46:19 GMT References: <1991Mar20.031419.3677@isis.cs.du.edu> <11195@dog.ee.lbl.gov> Organization: Widener CS Dept Lines: 25 Nntp-Posting-Host: shirley.cs.widener.edu In <11195@dog.ee.lbl.gov>, torek@elf.ee.lbl.gov writes: >In article <1991Mar20.031419.3677@isis.cs.du.edu> >cla@isis.UUCP (Chuck Anderson) writes: >>You can do a nice string copy with this construct as well: >> while (*dest++ = *source++); When I read something like this I automaticely think not equal to zero. > >Of course, you can also write it as: > > while ((*dest++ = *source++) != 0) /* or != '\0' */ > /* void */; > And when I am typing c code, rather often my thincking goes much faster then my typing, especialy with the the five kinds of key boards I normally use (IBM PC, VT101, VT330, sunwork station and macintosh) and all of those symbols slow me down. If I can pal to go through my program ofterwords I sometime put in the != 0 but only in cases that get rather complicated arguments in c. -- sven@cs.widener.edu Widener CS system manager Sven Mike Heinicke and Student (pssmheinicke@cyber.widener.edu (if you must))