+ The size is known at compile time.

vs.

- Can neither grow nor shrink them
- Can't append elements
- Can't remove elements
- Can't slice them
- Can't range them
- Assignment copies the whole array, as in int[5] a; auto b = a;
- Size is limited by stack
- Stack overflow issues


Some of the cons could be considered a feature.
Also GC but it's possible to make a dynamic array implementation which avoids the GC.

I'm not considering supposed performance benefits/penalties because these need to be profiled.

Considering the many downsides why would I ever want to choose a static over a dynamic array ?

Reply via email to