www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - porting problem

↑ ↓ ← Andrew McKinlay <mckinlay axonsoft.com> writes:
Here is a simplified version of what's causing me trouble:

	if (bool b2 = b)
		{
		char* p = "hello";
		}
	else
		{
		char* p = "world";
		}

gives: Error 'p' is already defined

However, this is fine:

	if (b)
		{
		char* p = "hello";
		}
	else
		{
		char* p = "world";
		}

I haven't had a problem with this on VC++ or GCC. Obviously, 
the code could (should?) be rewritten, but I'm porting a 
large program and I'd rather not have to. I'm curious what 
the "correct" behaviour is.

andrew
Dec 24 2004
↑ ↓ → "Walter" <newshound digitalmars.com> writes:
I'll add it to the problem queue. Thanks!
Dec 27 2004