tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing lint warnings



On Fri, Mar 23, 2012 at 10:37:42AM +0200, Alan Barrett wrote:
> In the medium term, I think that we should continue to use lint, and
> to fix problems that it reports.  However, some of the things that
> it reports are not real problems, but are bogus warnings that are
> traceable to limitations in the analysis done by lint, and these
> should not simply be silenced by adding casts.

That's the point that I contend. What are the actual problems that lint
reports and which of those aren't already handled by the compilers.
Use of negative values with shift? I consider that a bug in lint and not
of relevance for real world code. One complement is dead outside the IP
checksum. Implicit cast to narrower type? The compiler can do that and
is way more intelligent than lint in this regard. I don't think shutting
this up by adding explicit casts is generally the right approach. In
fact, I believe the cast should *only* be added if it is intended to
mark the implicit cast as potentially not value preserving. Is there
anything else?

In short, I strongly believe that lint warnings are bogus by default.
Error out on them makes no sense at all. Adding random /* LINTED */
comments doesn't helper either.

Joerg


Home | Main Index | Thread Index | Old Index