[comp.archives] [comp.lang.c] Re: Funny mistake

rob@array.UUCP (Rob Marchand) (03/22/91)

Archive-name: languages/debugger/nutshell-lint/1991-03-20
Archive-directory: uunet.uu.net:/nutshell/lint/ [137.39.1.2]
Original-posting-by: rob@array.UUCP (Rob Marchand)
Original-subject: Re: Funny mistake
Reposted-by: emv@msen.com (Edward Vielmetti, MSEN)

In article <15490@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>In article <1991Mar16.195153.15509@murdoch.acc.Virginia.EDU> gsh7w@astsun.astro.Virginia.EDU (Greg Hennessy) writes:
>-#>>"if (a = b)" instead of "if (a == b)". 
>-#>... I have yet to see a UNIX compiler complain about it
>-Doug Gwyn:
>-#That's good, because it is valid C and the compiler cannot know whether
>-#or not it reflects the programmer's intentions.
>-Then perhaps that is why having an optional flag to inform the user of
>-this sometimes suspicious code fragment may be a good idea.
>
>In the world of UNIX, we normally rely on "lint" to generate warnings
>about *possible* problems like this.  The compilers are expected to
>accept conforming translation units and silently translate them.

	There are several PD tools laying about that will catch this sort
	of thing, and print a warning.  As I understand it, they are 
	documented in one of the Nutshell Handbooks (hmm, Using Lint,
	or some such, by Ian Darwin?), which (I believe) include listings
	of the source code.  The source is also available in the 
	nutshell/lint subdirectory on uunet for anon. ftp.  I also have
	the stuff if anyone wants a copy.  No guarantees as to how well
	they work, etc.   Your mileage may vary.

	Cheers!
	Rob Marchand
-- 
Rob Marchand                   UUCP  : uunet!attcan!lsuc!array!rob
Array Systems Computing        ARPA  : rob%array.UUCP@uunet.UU.NET
401 Magnetic Drive, Unit 24    Phone : +1(416)736-0900   Fax: (416)736-4715
Downsview, Ont CANADA M3J 3H9  Telex : 063666 (CNCP EOS TOR) .TO 21:ARY001