DIP 1025--Dynamic Arrays Only Shrink, Never Grow--Community Review Round 1
jmh530
john.michael.hall at gmail.com
Mon Nov 11 13:25:35 UTC 2019
On Monday, 11 November 2019 at 10:27:26 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community
> Review for DIP 1025, "Dynamic Arrays Only Shrink, Never Grow":
>
> https://github.com/dlang/DIPs/blob/1b525ec4c914c06bc286c1a6dc93bf1533ee56e4/DIPs/DIP1025.md
>
> [snip]
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];
So actually
auto slice = cast(int*)malloc(10 * int.sizeof)[0 .. 10];
slice ~= 1;
generates an error because you can't append an int to an int*.
More information about the Digitalmars-d
mailing list