64 bit compiler for gcc/g++ that came with DevCPP (2005)

Hi guys

I foolishly (due to inexperience) did a project (with 30+ programs) using the compiler that came with DevCPP. The compiler allowed code like...

int x[atoi(argv[1])];

...which I'd imagine would not be allowed by modern 64 bit compilers. I've used this so much that I cannot go back and ammend my code (too much hassle as I'd have to use new and manage memory as well). Does anyone know a 64 bit compiler that will compile this type of syntax?
Last edited on
Modern versions of GCC still supports variable length arrays as a compiler extension.
http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
If you want to change your code to standard C++ I would recommend using std::vector instead of new.

Instead of int x[atoi(argv[1])]; you can do std::vector<int> x(atoi(argv[1])); and then access elements by index the same way as before. x[i]
Last edited on
I really recommend you go back and fix these issues. I really suspect that if you were doing this you didn't do very much validation on the variable that should probably also be taken care of. Even using the vector approach I recommend first validating your input parameter to insure it is indeed a valid number.

Topic archived. No new replies allowed.