Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.arch Subject: Re: Fun C typos (was *p++ = *q++) Message-ID: <15908@mimsy.UUCP> Date: 11 Feb 89 04:13:18 GMT References: <777@atanasoff.cs.iastate.edu> <223@nbires.nbi.com> <1184@houxs.ATT.COM> Distribution: usa Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 16 In article <1184@houxs.ATT.COM> beyer@houxs.ATT.COM (J.BEYER) writes: >for(i == 0; ... > >Now the funny thing was that i was seldom equal to zero on entry to this >loop, so it started at FALSE or 0 almost always. But once in a while >i did == 0, so the loop would start at TRUE sometimes. TRUE is not 0 in >our implimentation. Very vexing to find. This is not the proper group for this, but I have to say *something*. That is not how for loops work in C, and the true-value of any comparison operator in *any* correct C compiler is 1 (not -1, not 17, not 42, 1). The latter in particular in a common misconception, probably left over from FORTRAN (and BASIC) systems that used -1 as .TRUE.. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris