Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I'm learning c++

Name: Anonymous 2010-09-14 8:24

And my compiler is letting me do something weird.


If I do this:

int x; //matrix-size

cin >> x;

int array[x];

I can compile. I don't even get a warning. (I'm using the Codelite IDE for Linux, compiler is g++)

Does this work in c++ or is my compiler just fucking with me?

Name: Sensei 2010-09-14 9:30

>>4
This is the wrong approach to learning about the language and your compiler. Drafts of the C++ standard are available for free, which you can read to find out if variable length arrays are permitted in vanilla C++ (they're not). GCC has documentation that lists its extensions to C++, all of which are enabled by default (variable length array support is one of them, see http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List