Wish: Variable Not Used Warning

Bruce Adams tortoise_74 at yeah.who.co.uk
Thu Jul 10 12:53:53 PDT 2008


On Thu, 10 Jul 2008 10:01:25 +0100, Manfred_Nowak <svv1999 at hotmail.com>  
wrote:

> JAnderson wrote:
>
>> The more warnings as errors the better.  If I have to suffer a
>> little for false positives *shrug*
>
> What do you understand by "a little"?
>
> Please look at the example from
> http://www.digitalmars.com/webnews/newsgroups.php?
> art_group=digitalmars.D&article_id=73441
>
> Do you recognize how many warnings a lint tool might emit on that code?
> Would you admit then, that a paranoic lint would be quite useless, even
> if it detects that the variable `p' should be accessed? Would you
> admit, that you yourself are unable to decide whether the presence of
> some access statements to `p' should suppress the warning?

Generally there are two types of code. Code for which warnings are allowed
and warning free code. Transitioning from code that's been allowed to have  
warnings
for a long time to warning free code takes effort. I still think the long
term benefits make it worth it.

> My understanding of lint tools is, that they incorporate a collection
> of programming patterns together with a fuzzy recognition algorithm. If
> there are enough hits for a specific pattern, but it is still only
> partial implemented, then warnings are generated. Under this the
> primary question is: what is so special to the collection of
> programming patterns that they can be formalized into a lint tool but
> not be used as paradigms in the source language?
>
> -manfred
>
The reason is that the language specification is low level. It tells you  
how you
are allowed to put bricks together. Static analysis tools work at a much  
higher
level. They say things like, this is a load bearing wall putting a door  
here without a
lintal (pardon the pun) is unwise.
Semantic checks rely on trying to work out what your code is trying to do,  
its not just
following the steps to needed execute it (with certain exceptions).

Regards,

Bruce.



More information about the Digitalmars-d mailing list