c++ - porting problem
- Andrew McKinlay (24/24) Dec 24 2004 Here is a simplified version of what's causing me trouble:
- Walter (1/1) Dec 27 2004 I'll add it to the problem queue. Thanks!
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