DMD 1.039 and 2.023 releases

Brad Roberts braddr at puremagic.com
Wed Jan 7 20:37:30 PST 2009


BCS wrote:
> Reply to Brad,
> 
>> Restating in the form of a question... When would you _ever_ want
>> {...} to not form a scope?
>>
> 
> static if(foo)
> {
>    int i;
>    float x;
> }
> 

That and the version one are good examples.

However, the case example isn't.  It actually already forms a scope, and
that's a good thing.  Example:

switch (foo)
{
    case 1:
    {
       int i;
    }

    case 2:
       i = 0; // build error (error: undefined identifier i
}

Later,
Brad


More information about the Digitalmars-d-announce mailing list