dynamic arrays error

i was trying to make a dynamic array in this form :
int x;
cin>>x;
int ar[x];
my g++ (gcc) compiler on linux refused to create an array without a fixed size , however using the same code on windows on dev-cpp it was complied and executed , also it allowd me to create and use the dynamic array , i thought it was a compiler bug , however when i restarted and returned to g++ it compiled and executed the code although it never did before i tried the code on windows , how can that be and is it dangerous ?
It's a C99 feature that is not available in C++.
It might work on some compilers without pedantic mode enable, but:
1) It isn't standard and unportable
2) It is not stack allocated.
3) There is more problems than benefits with it.
the whole thing is , that the same compiler(gcc) that refused to compile this code before compiling it in dev-cpp , is now compiling it with no errors !!! , how can this be ?
he whole thing is , that the same compiler(gcc) that ...
By same do you mean GCC on Windows and Linux? They're likely to be different versions.
no , i mean i used GCC to compile and it popped up errors , restarted and used the same GCC on the same operating system (consider it just restarted my machine) and suddenly it can now compile the same code !!!!
Topic archived. No new replies allowed.