C++ guys hate static_if?
monarch_dodra
monarchdodra at gmail.com
Sat Mar 9 03:51:36 PST 2013
On Saturday, 9 March 2013 at 09:41:42 UTC, simendsjo wrote:
> On Saturday, 9 March 2013 at 09:12:30 UTC, Jouko Koski wrote:
>> "Walter Bright" wrote:
>>
>>> Many of the criticisms in the paper are addressed by our
>>> positive experience with static if in D.
>>
>> Sometimes I do find it confusing that { does or does not
>> introduce a new scope in a very similar-looking contexts.
>
> Is there more constructs than static if that doesn't create a
> scope?
"Labeled scopes" (ironically) don't create scopes. Eg:
//----
some_label:
{
int a;
//Code code code
}
a = 5;
goto some_label;
//----
That doesn't actually create a new scope, and that assignement is
legal game.
This is from the official documentation, so it is not a bug. I
can't, for the life of me, understand why it is that way, in
particular, since it deviates from C. I see it as a "never
better, sometimes worst" approach.
I've tried to ask about it before, but I best, the answer I got
was "works as documented", but still have no idea on the why :/
???
And since goto is "evil", I think very few people care, so
getting any kind of activity about this is hard.
More information about the Digitalmars-d
mailing list