Why does my compiler let me do this...

Was reading an article on dynamic memory allocation here...


Why does my compiler (g++ that comes with cygwin) allow me to do this...

#include <cstdlib>

using namespace std;

int main(int argc, char** argv) {
int size=10;
int array[size];
return 0;

It is allowed in C - and the GCC compiler allows it when compiling C++ code (which I believe is something they should change as it is against C++ standard).
GCC has the option -pedantic to flag supported deviations from the standard, and -pedantic-errors to make those deviations fatal errors.
Topic archived. No new replies allowed.