CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Posts
    31

    label declaration space block

    As per specs, chapter 3, basic concepts...

    "Each block or switch-block creates a separate declaration space for labels. Names are intorduced into this declaration space through labeled statements, and the names are referenced through goto-statements. The label declaration space of a block icludes any nested blocks, Thus, within a nested blocks it is not possible to declare a label wiht the same names as a label in a n enclosing block."


    why the following code is perfectly compiled?

    class A
    {
    void foo()
    {
    for( int i = 0 ; ; i++ )
    if( i == 1 ) goto yourend;
    yourend:
    {
    int k = 0;
    yourend:
    {
    int l = 0;
    }
    }
    }

    }

  2. #2
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    265
    Good question :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured