why array do not support gcc style Initialize way?

Paul Backus snarwin at gmail.com
Wed Sep 11 19:19:51 UTC 2019


On Wednesday, 11 September 2019 at 12:00:01 UTC, lili wrote:
> Hi:
>     In C array init is early than D。
>     int ary[3]={[1]=2};
>     int ary[100]={[10 ... 20]=10};
>     Why D betterC do not support this way。

D's array initialization uses different syntax from C:

     int[3] ary = [ 1: 2 ]; // index: value

For details, see the D language specification's section on static 
array initialization:
https://dlang.org/spec/arrays.html#static-init-static


More information about the Digitalmars-d mailing list