www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - undefined label

reply Manfred Nowak <svv1999 hotmail.com> writes:
<code>
void main(){
  end: ;
  void f(){
    goto end;
  }
}
</code>

Why is `end' undefined?

-manfred
Aug 06 2005
parent Chris Sauls <ibisbasenji gmail.com> writes:
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: -- Chris Sauls
Aug 07 2005