Funny mistake
Larry Campbell
campbell at redsox.bsw.com
Wed Mar 20 12:49:02 AEST 1991
In article <8148 at rsiatl.Dixie.Com> stan at Dixie.Com (Stan Brown) writes:
->Hell, I have no idea what "fct" is for; but that remains me my mistakes,
->a VERY hard to catch one, because the string (see below) is still perfect
->C code (like that above - no SYNTAX error there!) :
-
->"if (a = b)" instead of "if (a == b)".
-
- Some compilers will report this as a suspicous occurence. The
- one I think I remember this on is Zortech, but I have yet to
- see a UNIX compiler complain about it, The lint on my mchine
- doesn't complain eithe. I wonder if anybody's does ?
Under SVR4:
/home/campbell> cat test.c
#include <stdio.h>
void foo(int a, int b)
{
if (a = b)
(void) printf("yow!\n");
}
/home/campbell> lint -u test.c
(5) warning: assignment operator "=" found where "==" was expected
set but not used in function
(3) a in foo
I think the lint that comes with it is itself reason enough to run SVR4.
--
Larry Campbell The Boston Software Works, Inc., 120 Fulton Street
campbell at redsox.bsw.com Boston, Massachusetts 02109 (USA)
More information about the Comp.lang.c
mailing list