do-while loops

Jonathan M Davis jmdavisProg at
Wed Dec 28 13:00:40 PST 2011

On Wednesday, December 28, 2011 21:37:56 Timon Gehr wrote:
> Well, do loops are the least frequently used looping constructs. Also,
> if you actually have code like the following
> import foo; // defines global symbol 'x'
> void main(){
>      do {
>          int x;
>          // ...
>      }while(x<2);
> }
> It is likely that it is actually buggy because the programmer assumed
> lookup would work differently.

I don't know whether the change is worth making or not (it arguably does 
introduce an inconsistency into the scoping rules - though it _would_ 
definitely be useful), but I wouldn't really expect it to break any code. And 
I'd have to concurr that if it did, odds are that the code was buggy anyway.

- Jonathan M Davis

More information about the Digitalmars-d-learn mailing list