What's the point of static arrays ?

psycha0s box at mail.com
Thu Jul 9 13:56:24 UTC 2020


On Thursday, 9 July 2020 at 12:12:06 UTC, wjoe wrote:
> Also GC but it's possible to make a dynamic array 
> implementation which avoids the GC.
It's easy to make a dynamic array without using the GC. Did you 
mean "implementation which avoids memory management"?

> 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 ?
Sometimes the amount of elements is known at compile time so you 
don't need to waste CPU cycles for memory allocation/freeing. 
This can be really important when you work on a 
performance-critical code.


More information about the Digitalmars-d-learn mailing list