August 07, 2005
<code>
void main(){
  end: ;
  void f(){
    goto end;
  }
}
</code>

Why is `end' undefined?

-manfred
August 07, 2005
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