August 07, 2005 undefined label | ||||
|---|---|---|---|---|
| ||||
<code>
void main(){
end: ;
void f(){
goto end;
}
}
</code>
Why is `end' undefined?
-manfred
| ||||
August 07, 2005 Re: undefined label | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | Manfred Nowak wrote:
> <code>
> void main(){
> end: ;
> void f(){
> goto end;
> }
> }
> </code>
>
> Why is `end' undefined?
I won't swear to it: but probably because labels are specific to their scope. And/or because functions (even inline ones, technically) are anchored to their frame, so a 'goto' pointing outside that frame won't work. Same reason this doesn't:
# void bob () {
# L_inBob: ;
# }
#
# void foo () {
# goto L_inBob;
# }
-- Chris Sauls
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply