DIP 1025--Dynamic Arrays Only Shrink, Never Grow--Community Review Round 1

Adam D. Ruppe destructionator at gmail.com
Mon Nov 11 13:26:56 UTC 2019


On Monday, 11 November 2019 at 13:25:35 UTC, jmh530 wrote:
> In that first example, the following
> int[] slice = cast(int*)malloc(10 * int.sizeof)[0 .. 10];
> doesn't actually compile.
>
> You would compile it as
> auto slice = cast(int*)malloc(10 * int.sizeof)[0 .. 10];

It should probably just be

int[] slice = (cast(int*)malloc(10 * int.sizeof))[0 .. 10];


Since the type certainly should be int[], and it will compile.


More information about the Digitalmars-d mailing list