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

Salih Dincer salihdb at hotmail.com
Fri Jul 15 06:22:48 UTC 2022


On Friday, 15 July 2022 at 05:50:33 UTC, Paulo Pinto wrote:
> 
> ```csharp
>    Span<int> arr = stackalloc int[] {1, 2, 3};
> ```

It's a very long C# code, but they're right on this rationale for 
D:

> The programmer must remember to update the integer literal in 
> the static array declaration from 2 to 3, else face a compiler 
> error.

SDB at 79


More information about the Digitalmars-d mailing list