digitalmars.D - Is this a bug with goto?
- Jerry Quinn (15/15) Apr 17 2010 In the spec it says that it's illegal to skip an initialization using go...
- Andrei Alexandrescu (5/20) Apr 17 2010 (Hi Jerry! Glad to see you're ramping up participation lately.) Yes,
- Kagamin (2/6) Apr 17 2010 That's why we need new properly scoped switch syntax, lol.
- Jerry Quinn (4/7) Apr 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4101
In the spec it says that it's illegal to skip an initialization using goto. Unless I'm mistaken, the code below does that for b, s, and c. However, it compiles without complaint. So, should the compiler be complaining, or is the text about goto really saying that behavior is undefined. Obviously the latter makes it easier for the compiler writer :-) void foo() { goto L0; int b; struct S { int a; this(int c) { a=c; } } S s = S(5); class C { int a; } C c = new C; L0: ; s.a++; c.a++; } thanks, Jerry
Apr 17 2010
On 04/17/2010 11:11 AM, Jerry Quinn wrote:In the spec it says that it's illegal to skip an initialization using goto. Unless I'm mistaken, the code below does that for b, s, and c. However, it compiles without complaint. So, should the compiler be complaining, or is the text about goto really saying that behavior is undefined. Obviously the latter makes it easier for the compiler writer :-) void foo() { goto L0; int b; struct S { int a; this(int c) { a=c; } } S s = S(5); class C { int a; } C c = new C; L0: ; s.a++; c.a++; } thanks, Jerry(Hi Jerry! Glad to see you're ramping up participation lately.) Yes, that's a bug. There are many other bugs related to jumps, including in switch statements. Andrei
Apr 17 2010
Andrei Alexandrescu Wrote:(Hi Jerry! Glad to see you're ramping up participation lately.) Yes, that's a bug. There are many other bugs related to jumps, including in switch statements.That's why we need new properly scoped switch syntax, lol.
Apr 17 2010
Andrei Alexandrescu Wrote:(Hi Jerry! Glad to see you're ramping up participation lately.) Yes, that's a bug. There are many other bugs related to jumps, including in switch statements.http://d.puremagic.com/issues/show_bug.cgi?id=4101 cheers, Jerry
Apr 17 2010