Super Lint

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Wed Sep 20 13:19:18 PDT 2006


Walter Bright wrote:
> Pragma wrote:
>> Walter Bright wrote:
>>> I've been interested in various ideas for static checking for common 
>>> bug patterns for D. For example:
>>>
>>>     for (int i = 0; i < 10; i++)
>>>     {    foo();
>>>         break;
>>>     }
>>>
>>> would be flagged as a suspicious use of break. Are there any 
>>> legitimate uses of break in this manner? Any thoughts and ideas in 
>>> this direction?
>>
>>
>> Well, one could throw from within foo(), but that would still abort 
>> the loop on the first pass.  Nope, there's no legitimate use I can 
>> think of.
>>
>> Are you considering making a lint tool for D?
> 
> Not exactly. Lint finds things that might be bugs, but my experience 
> with Lint is it flags legitimate code patterns as bugs. I'd prefer to do 
> things that are out and out bugs, like the example above.

But is it safe do declare the above example as a bug? Maybe that break 
is placed there to see what just one pass of the loop does (maybe for 
debugging purposes).



More information about the Digitalmars-d mailing list