DMD 1.039 and 2.023 releases

Jason House jason.james.house at gmail.com
Wed Jan 7 16:04:50 PST 2009


Walter Bright Wrote:

> redsea wrote:
> > I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII
> > variable destructor is not called) has been fixed, Great !
> > 
> > I have some questions when I check dstress suite and Bugzilla.
> > 
> > In Bugzilla 99,  according to test case:
> > 
> > int main(){ int i;  label: { scope(exit) i++; i=3; }
> > 
> > if(i != 4){ assert(0); }
> > 
> > return 0; }
> > 
> > You said:
> > 
> > The test case behaves as expected, because labels do not introduce a
> > new scope when followed by { }.
> > 
> > 
> > Then I check the online manual, and found:
> > 
> > labels, scope(), pragma, condition compile(version/debug/static if)
> > would be followed by NonScopeStatement.
> > 
> > It is easy to understand scope/condition compile followed by a
> > NonScopeStatement, but what is the meaning of  "Labeled Statements"
> > + NonScopeStatement ?
> 
> A NonScopeStatement is a statement that, even if it has { }, does not 
> introduce a new scope.

I don't think this answers their question. What curly braces mean after a label is clearly a design decision that you made when writing D. It seems that the choice is the opposite of what people expect. Can you explain why it should be NonScope?
 
> > 
> > If I understand the rule I would make least mistakes, so can you do
> > some explain for me ?  Thanks.



More information about the Digitalmars-d-announce mailing list