Here is a question for you guys. I used to think that C++ compiler should not accept dynamic array allocation when the dimension of an array is calculated during run-time, like this:
...
//..compute value of n at run-time
double a[n];
...
However I have a code (below) doing this, and it compiles (in g++ (GCC) 4.7.2 20120920 (Cray Inc.)) and runs just fine. Is it supposed to work like this?
Lots of C++ compilers use a C backend so they will let you do this. There might be some command line args you can pass to prevent this, but I don't know what they would be.