On 22.01.2016 15:33, Shriramana Sharma wrote:
It would seem that in the case of arrays, the former is preferable to the
latter, as per the para above this header:

http://ddili.org/ders/d.en/const_and_immutable.html#ix_const_and_immutable.variable,
%20immutable

The link doesn't work for me, but yes, `static immutable` is usually better for arrays than `enum`.

But a further question, if I don't declare them as `static immutable` but
just as `immutable`, would that mean that those arrays are necessarily
created (meaning memory allocation) every time the function is run?

I guess compilers may reuse the same array for all calls, seeing that the value is a constant, but I don't think they're required to do so.

Reply via email to