auto arr = [1, 2, 3] should be a static array, not a GC allocated array

Salih Dincer salihdb at hotmail.com
Wed Jul 20 04:51:10 UTC 2022


On Thursday, 14 July 2022 at 15:13:07 UTC, jfondren wrote:
> Static arrays are still very nice in D, especially their array 
> ops https://dlang.org/spec/arrays.html#array-operations , but 
> they require extra care in more ways than this.

I think the topic is conclude... Criticisms were made and 
requests received.  In the specs, the [12.12 Static Array 
title](https://dlang.org/spec/arrays.html#static-arrays) says:

> 5.3.Because static arrays are passed to functions by value, a 
> larger array can consume a lot of stack space. Use dynamic 
> arrays instead.

Is it necessary to open a new topic but I need more explanation?

SDB at 79


More information about the Digitalmars-d mailing list