[net.unix-wizards] On C Checkers

chris.umcp-cs@UDel-Relay (02/28/83)

From:     Chris Torek <chris.umcp-cs@UDel-Relay>
Date:     31 Dec 82 04:29:17 EST  (Fri)
I haven't seen cchk, but I'll bet it doesn't find this error:

	while (cp < cend)
		*cp++ == *ct++;

where the == should be a single equals sign.  Lint doesn't find this;
cc doesn't; and it took me about a half hour in a relatively short
piece of code!  (I think Whitesmith's compiler would report "useless
expression".)

It's the sort of thing you can easily skip over, since it looks
so similar to what it should say.

dbj.rice@Rand-Relay (03/17/83)

From:  Dave Johnson <dbj.rice@Rand-Relay>

Lint DOES find the error in the program fragment:

	while (cp < cend)
		*cp++ == *ct++;

but only if you give lint the "-h" flag to tell it to "Apply a number of
heuristic tests to attempt to intuit bugs, improve style, and reduce waste."
Lint will report "warning: null effect" giving the correct line number
of the "*cp++ == *ct++;" line.  I haven't seen cchk either, but I have
become a strong believer in lint.

                                        Dave Johnson
                                        Dept. of Mathematical Sciences
                                        Rice University


P.S.  I tried to send this before, but my mesage seems to have vanished
      somewhere around the CSNet connection...