allangal
September 18th, 2002, 11:13 AM
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;
}
}
}
}
"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;
}
}
}
}