ok@edai.UUCP (01/19/84)
I like putting great big block comments in my C programs.
I like putting examples of how to use various things in those comments.
And of course well-written examples are commented.
So the scheme I use is
#if 0 /* COMMENT */
... lots of text ...
... bits of C code, which can safely use /* comments */
... lots of text ...
#endif 0 /* COMMENT */
The two lines starting with a sharp are precisely what I type.
Now I have used 6 different C compilers on 4 different kinds of
machines, and all but the version 6+ PDP-11 C pre-processor were
quite happy with it. In v6+ I had to say #ifdef COMMENT and be very
very careful never to define COMMENT.
As a careful programmer, I would like to use "lint". BUT lint
evidently thinks 0 is true, and TRIES TO COMPILE MY COMMENTS!!!!
I have put together an interface to lint that shoves all the files
through the preprocessor (courtesy of "cc -E"), but it tends to tie
up file space and from time to time I forget to use it.
Can anyone tell me
(a) why "lint" does something so very different from /lib/cpp with #if 0
(b) whether there is an easy way to tell it not to
(c) whether System III/System V "lint" is this stupid (there must be
*some* reason why people get S3 instead of 4.1).gnu@sun.uucp (John Gilmore) (01/27/84)
I believe this is a cpp bug. Lint is a shell script -- try catting it. It invokes "cpp -C -Dlint" on your files and processes the output. The -C is to keep the comments (eg, /*NOTREACHED*/). However, some versions of cpp have a bug where a comment on an #if screws up. This never bothers the compiler since it asks that cpp strip comments anyway, but shows up for lint. There's probably a relatively trivial fix for this problem in cpp but I don't have it at hand. Any volunteers?