D - BUG: Duplicate variable names allowed inside if() block
- Russ Lewis (14/14) Oct 05 2002 This program goes through the compiler ok, although I believe it should
- Walter (3/12) Oct 07 2002 It is legal, as { } introduces a new scope. -Walter
- Dario (4/5) Oct 07 2002 Oh, I thought that duplicate local variables weren't allowed in D.
- Walter (3/8) Oct 07 2002 You're right, my goof. I'll log it as a bug. -Walter
- Sean L. Palmer (4/17) Oct 07 2002 I thought you said locals that hide other locals are an error.
- Russ Lewis (8/21) Oct 07 2002 I knew that used to be true in C/C++, but I thought that we were getting...
This program goes through the compiler ok, although I believe it should be a syntax error: int main() { int bar; if(true) { int bar; } return 0; } -- The Villagers are Online! http://villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Oct 05 2002
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D9F31D9.F0F445CD deming-os.org...This program goes through the compiler ok, although I believe it should be a syntax error: int main() { int bar; if(true) { int bar; } return 0; }It is legal, as { } introduces a new scope. -Walter
Oct 07 2002
It is legal, as { } introduces a new scope. -WalterOh, I thought that duplicate local variables weren't allowed in D. You've written it in the language specs: "It is an error to declare a local variable that hides another local variable in the same function"
Oct 07 2002
You're right, my goof. I'll log it as a bug. -Walter "Dario" <supdar yahoo.com> wrote in message news:ansdvl$m59$1 digitaldaemon.com...It is legal, as { } introduces a new scope. -WalterOh, I thought that duplicate local variables weren't allowed in D. You've written it in the language specs: "It is an error to declare a local variable that hides another local variable in the same function"
Oct 07 2002
I thought you said locals that hide other locals are an error. Sean "Walter" <walter digitalmars.com> wrote in message news:ans8cq$113g$1 digitaldaemon.com..."Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D9F31D9.F0F445CD deming-os.org...This program goes through the compiler ok, although I believe it should be a syntax error: int main() { int bar; if(true) { int bar; } return 0; }It is legal, as { } introduces a new scope. -Walter
Oct 07 2002
Walter wrote:"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D9F31D9.F0F445CD deming-os.org...I knew that used to be true in C/C++, but I thought that we were getting rid of that. Oh well :) -- The Villagers are Online! http://villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]This program goes through the compiler ok, although I believe it should be a syntax error: int main() { int bar; if(true) { int bar; } return 0; }It is legal, as { } introduces a new scope. -Walter
Oct 07 2002