dimanche 26 juillet 2015

Can I use C dynamic array in C++03 and C++11?

C has a really cool feature called dynamic arrays. Its available in C90 and above, and it allows deferring the size of the array until runtime. See GCC's manual 6.19 Arrays of Variable Length.

I'm working in C++. At std=c++11, I'm catching a compile failure due to the use of alloca. I want to switch to dynamic arrays, if possible. I also want to try and avoid vector because I want to stay out of the memory manager. I believe every little bit helps, so I'm happy to take these opportunities (that some folks consider peepholes).

Can I use C dynamic array in C++03 and C++11?

Aucun commentaire:

Enregistrer un commentaire