From: SourceForge.net <no...@so...> - 2009-03-27 13:23:45
|
Bugs item #2716907, was opened at 2009-03-27 14:23 Message generated for change (Tracker Item Submitted) made by drdonut You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2716907&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: MinGW Group: Feature requests Status: Open Resolution: None Priority: 5 Private: No Submitted By: D on (drdonut) Assigned to: Nobody/Anonymous (nobody) Summary: Program crashes on runtime after multiple delacrations Initial Comment: Hi, It seems that the MingW compiler behaves a bit strange in this case. So I had a problem that crashed during runtime, and I found out what the problem was. When there is a declaration of a character string within an if-statement, and this is followed by a declaration of a character pointer with the same name, then the program crashes on runtime (duh) but the compiler does not generate warnings/errors. I've written this simple sample program to show what I mean: #include <iostream> using namespace std; int main() { cout<<"Enter value 0 or 1"<<endl; bool a; cin >> a; if (a==true){ char somestring[100];} char * somestring = ""; strcpy(somestring, "blaat"); cout<<somestring<<endl; getchar(); return 0; } As you can see, there is clearly something wrong with this code, that's for sure. My point is that this program crashes on runtime, no matter what variable "a" is and the compiler does not generate any warning or error messages. Can a feature like that be included? OS: Windows XP sp2 gcc: 3.4.2 GNU ld version: 2.15.91 20040904 IDE: Dev-cpp 4.9.9.2 Thanks in advance ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2716907&group_id=2435 |