Re: Static initialization of static arrays is weird

2018-08-19 Thread Dennis via Digitalmars-d-learn
On Sunday, 19 August 2018 at 12:10:08 UTC, kinke wrote: I think the spec is pretty clear; the elements of the right-hand-side initializer array are interpreted as per-element initializer, i.e., `result[0] = 2, result[1] = 1` (rest: default-init). I can't find where in the spec it says that th

Re: Static initialization of static arrays is weird

2018-08-19 Thread kinke via Digitalmars-d-learn
On Sunday, 19 August 2018 at 11:20:41 UTC, Dennis wrote: I have a two dimensional static array in a game board struct and want to explicitly set the default value for each cell. Now typing the whole 9x9 array out would be cumbersome and I can't change the default constructor of a struct, so I p

Static initialization of static arrays is weird

2018-08-19 Thread Dennis via Digitalmars-d-learn
I have a two dimensional static array in a game board struct and want to explicitly set the default value for each cell. Now typing the whole 9x9 array out would be cumbersome and I can't change the default constructor of a struct, so I played around with initializers and found some... strange