[net.sources.bugs] cchk

draper@sdcsla.UUCP (Steve Draper) (11/02/84)

Thank you to Andries for the bug reports, which I have fixed in my version.
If anyone wants a copy of my corrected version, just ask and I will send it
to you.  I have also implemented a more liberal policy about indentation
which reduces the number of complaints about public source files.  However
in order to allow a checker to detect errors, some changes in programming
style have to be  made.  Style is like hand-writing: you have to be
familiar with the individual's style in order to decipher the blots and
errors.  I find it worth the effort to conform to cchk's style, but then of
course I wrote cchk to reflect a style I liked.

If the error messages are too annoying, you can try using the -q flag which
suppresses the ones most likely to be caused merely by differences in style.
However the most persistent source of useless error messages when running
cchk on public source files is now the use of assignment in conditionals
without an extra pair of parentheses.  Nevertheless I still find it
informative to run cchk on public source files: it has found cases of what
I think are genuine bugs due to dangling elses in, for instance, the UCB
more and ar.c. 
 	My main use of it however is to check my own new code, where it
often catches very fast some silly slips, and is much more helpful.  (Just
compare the ouput of cc and cchk on a program where you forgot to close a
brace.)

I agree with the principle behind Andries' remark that the only good way to
do it would be with lex and yacc.  However even if I had the time, I don't
immediately see how to do it cleanly since the central idea in cchk is to
combine information from syntax and indentation which means at the least
associating more information from the lex features with words than is
usually done.  Still no doubt a little work would solve it.

One last remark: I didn't understand why Andries thought STACKSIZ should be
set to 100.  I have it set to 40, and have never had it run out.

				Steve Draper
				UCSD, San Diego
				ucbvax!sdcsvax!sdcsla!draper   draper@nprdc