Nested Comments in C -- A recent experience

A. Lester Buck buck at siswat.UUCP
Wed Mar 14 15:28:24 AEST 1990


In article <1990Mar11.065712.9798 at usenet.ins.cwru.edu> crds at pyrite.som.cwru.edu (Glenn A. Emelko) writes:
>If the C compiler understood nested comments it would FORCE
>programmers to match them, preventing wasted hours of debugging on
>annoying problems like the above at the expense of a few milliseconds
>of additional compile time.

Try the lint helper programs at uunet!~/nutshell/lint/* as described in
the Nutshell handbook on lint.

These programs include:

cchk - cchk check C programs for correctly matching brackets of all kinds
(including quotes and comment brackets), checks that the indentation of
matching brackets also matches, and checks for symptoms of three kinds of
errors that the C compiler allows without warning: 'dangling else' errors
where an else is bound to the wrong preceding if, nested comments (where
the first close-comment bracket prematurely ends the outer comment), and
the use of assigment ('=') where equality-test ('==') was meant.  It is
faster than the compiler and produces better messages; in particular,
it localizes bracketing problems much more accurately.

cchk was written by Steve Draper at Berkeley.


-- 
A. Lester Buck     buck at siswat.lonestar.org  ...!texbell!moray!siswat!buck



More information about the Comp.lang.c mailing list