YALF (yet another lint foulup)
Mark A Terribile
mat at mole-end.UUCP
Sun Dec 18 04:28:53 AEST 1988
For the code fragment:
. . .
do
{
return 1 ;
} while( 0 )
}
> "lint" has no way of knowing, given its somewhat unsophisticated
> analysis, that the loop never terminates; ...
> function *would* have something that amounts to just a "return;".
...
> ... there is actually a "lint" feature to be used in this case:
>
> /*NOTREACHED*/
I believe that /*NOTREACHED*/ is for things like exit(), which cannot return
at all. Given that LINT professes to know about variables used before set,
it is certainly LINT's business to do a little basic flow analysis. It
would be nice if LINT would warn that this ``loop'' does not and can not loop.
The parsing and data type analysis that LINT actually must do is much
hairier than the linked-list games that you play to find out what is and
isn't reached. Moreover, it would help LINT to get the used/set checks
right.
With ANSI C and function prototypes, we may hope that LINT goes away. We
now understand better what sort of checks to apply (Bjarne Stroustrup's C++
processors do a much better job than LINT, and without the extraneous noise)
and it makes sense to put them in the compiler.
--
(This man's opinions are his own.)
>From mole-end Mark Terribile
More information about the Comp.lang.c
mailing list