www.digitalmars.com         C & C++   DMDScript  

D - label & variable

reply "Vathix" <Vathix dprogramming.com> writes:
int main()
{
 label:
 int foo;
 foo = 0;
 return foo;
}

DMD output:  file.d(5): undefined identifier foo


Should this be? If I put a semicolon after the label, it works. I know the
semicolon is required before a } in a block, that makes sense.. but I don't
know about this.  Just making sure.
May 31 2003
parent "Matthew Wilson" <matthew stlsoft.org> writes:
Looks like a bug. Doesn't make sense otherwise

"Vathix" <Vathix dprogramming.com> wrote in message
news:bbah4s$1qit$1 digitaldaemon.com...
 int main()
 {
  label:
  int foo;
  foo = 0;
  return foo;
 }

 DMD output:  file.d(5): undefined identifier foo


 Should this be? If I put a semicolon after the label, it works. I know the
 semicolon is required before a } in a block, that makes sense.. but I
don't
 know about this.  Just making sure.
May 31 2003