Newsgroups: comp.lang.c
Path: utzoo!telly!rickc
From: rickc@telly.on.ca (Rick Copley)
Subject: Re: Funny mistake
Organization: Somewhere just far enough out of Toronto
Distribution: comp.lang.c
Date: Wed, 20 Mar 91 17:34:53 GMT
Message-ID: <27E79D3E.1667@telly.on.ca>
References: <13337@helios.TAMU.EDU> <8148@rsiatl.Dixie.Com> <1991Mar15.180449.13100@motcad.portal.com>

In article <1991Mar15.180449.13100@motcad.portal.com> jtc@motcad.portal.com (J.T. Conklin) writes:
>In article <8148@rsiatl.Dixie.Com> stan@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@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@telly.on.ca

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