Funny mistake

Rick Copley rickc at telly.on.ca
Thu Mar 21 03:34:53 AEST 1991


In article <1991Mar15.180449.13100 at motcad.portal.com> jtc at motcad.portal.com (J.T. Conklin) writes:
>In article <8148 at rsiatl.Dixie.Com> stan at Dixie.Com (Stan Brown) writes:
>>>"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 ?
>
>Gimpel's FlexeLint:
>     if (a = b)
>     foo.c  5  Info 720: Boolean test of assignment
>
>
>-- 
>J.T. Conklin    jtc at motcad.portal.com, ...!portal!motcad!jtc


The following program on an NCR Tower SYS 5r3 (AT&T based) system produces
"2 and 2 are equal" when executed and lint procudes no complaints at all.

main()
{
  int a, b;

  a = 1;
  b = 2;

  if (a = b)
    (void)printf("%d and %d are equal\n", a, b);

  return(0);
}

I will try this program at home with my MCS 5.1 compiler with the /W3 option
and see what it says, and get back to ya.

rickc at telly.on.ca

-- 
#include <sys/types.h>
main()
{
  typedef long lotsa;
  lotsa *fun;
  time_t in;
  fun = (lotsa)hack(in);
}



More information about the Comp.lang.c mailing list