This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ compiling code that is wrong.
- From: Joel Jansson <biitar at home dot se>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 27 Apr 2005 22:48:31 +0200
- Subject: g++ compiling code that is wrong.
Hello.
I dont know if I am to write here, but I think I found a bug that I know
is not related to my hardware or my system. Problem is that I don't know
how to report it or if it allready been reported(Kind of hard to search
for a bug when you dont know how to describe it.).
Backstory : I am a bit of a newbie on C++ and was doing a
schoolassigment where I was to make a dynamic array. I didn't do it
right but the code compile(and work on gentoo, didn't work on windowsXP)
anyway.
Instead of using new and delete[] when making the array, I wrote a code
that was something like this :
{
int b;
char a[b];
cout << "bla bla bla";
cin.getline(a,b);
}
The code compile both on gentoo linux(gcc 3.3.5 gcc 3.4.3) and
windowsXP(Minigw 3.2.0-rc3) and on my friends computer under gcc(I
belive Cygwin, dont know which version). I haven't tried it on newer
versions, so I don't know if you already fixed it.
According to the friend(who work as a c++ programer doing apps and stuff
on linuxsystems) and the teacher, this code is shouldn't be able to
compile at all(Which it didn't under MS visual studio).
I was compiling with no options, just g++ but now I saw there was a
-pedantic options and I tried it which return error.
Hope I didn't waste your time with a bug allready reported, but I
thought it would be better to report it just incase.
/Joel