Super Lint

Walter Bright newshound at digitalmars.com
Wed Sep 20 14:48:07 PDT 2006


xs0 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, I occasionally write something similar:
> 
> for (int i = 0; i < max_retries; i++) {
>     try {
>         foo();
>     } catch (Exception e) {
>         continue;
>     }
>     break;
> }

Hmm. That does look like a quite reasonable use case.



More information about the Digitalmars-d mailing list