auto arr = [1, 2, 3] should be a static array, not a GC allocated array
Dave P.
dave287091 at gmail.com
Thu Jul 14 17:46:18 UTC 2022
On Thursday, 14 July 2022 at 17:33:22 UTC, bachmeier wrote:
> On Thursday, 14 July 2022 at 15:26:44 UTC, Dave P. wrote:
>> On Thursday, 14 July 2022 at 14:51:01 UTC, bachmeier wrote:
>>> On Thursday, 14 July 2022 at 13:14:59 UTC, ryuukk_ wrote:
>>>> It is misleading, nobody expect this to be GC allocated
>>>> [...]
>
> That would be a potential justification. OP claims nobody would
> expect a dynamic array, though, and matching C's behavior
> hardly makes the design choice obvious.
>
Yes, I forgot to write the other half of my comment. I am also
annoyed by this behavior, but I would be able to work around it
if there was a convenient way to specify a static array of
inferred length. Ansi C has this, D does not.
More information about the Digitalmars-d
mailing list