digitalmars.D - goto at end of block
- Steve Teale (17/17) Mar 19 2009 OK, the spec says that:
 - Jesse Phillips (2/26) Mar 19 2009 Why? This is probably done for the same reason you cane do for(...);
 
OK, the spec says that:
A goto transfers to the statement labelled with Identifier. 
but couldn't the closing brace of a scope be regarded as an empty statement.
int foo()
{
   {
      goto L1;
      return 1;
L1:
   }
   return 0;
}
fails, but of course
L1:
      ;
   }
is OK.
 Mar 19 2009
On Thu, 19 Mar 2009 03:57:04 -0400, Steve Teale wrote:
 OK, the spec says that:
 
 A goto transfers to the statement labelled with Identifier.
 
 but couldn't the closing brace of a scope be regarded as an empty
 statement.
 
 int foo()
 {
    {
       goto L1;
       return 1;
 L1:
    }
    return 0;
 }
 
 fails, but of course
 
 L1:
       ;
    }
 
 is OK.
Why? This is probably done for the same reason you cane do for(...);
 Mar 19 2009








 
 
 
 Jesse Phillips <jessekphillips gmail.com>