why array do not support gcc style Initialize way?
Paul Backus
snarwin at gmail.com
Wed Sep 11 19:55:00 UTC 2019
On Wednesday, 11 September 2019 at 19:44:47 UTC, Meta wrote:
> On Wednesday, 11 September 2019 at 19:19:51 UTC, Paul Backus
> wrote:
>> 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
>
> Wow, I've been using D for 7 years and had no idea this was
> possible. Normally the [ 1:2 ] syntax defines an associative
> array; do you happen to know where in the spec this is
> mentioned, if at all?
It's right under the header I linked to in my message :)
More information about the Digitalmars-d
mailing list