Re: Static initialization of rectangular arrays

2019-08-29 Thread rombankzero via Digitalmars-d-learn
On Thursday, 29 August 2019 at 19:06:04 UTC, kinke wrote: Sorry, that was wrt. the linked bugzilla and not this example here. - What does work is `static double[6][3] matrix = [0, 0, 0]`, i.e., initializing each nested 1D array with a scalar 0. I guess I'll use this workaround, though

Re: Static initialization of rectangular arrays

2019-08-29 Thread kinke via Digitalmars-d-learn
On Thursday, 29 August 2019 at 18:59:22 UTC, kinke wrote: On Thursday, 29 August 2019 at 18:11:50 UTC, Les De Ridder wrote: It's a known bug[1]. As a workaround you could use a `static this()`: Or LDC, and GDC probably too. Sorry, that was wrt. the linked bugzilla and not this example

Re: Static initialization of rectangular arrays

2019-08-29 Thread kinke via Digitalmars-d-learn
On Thursday, 29 August 2019 at 18:11:50 UTC, Les De Ridder wrote: It's a known bug[1]. As a workaround you could use a `static this()`: Or LDC, and GDC probably too.

Re: Static initialization of rectangular arrays

2019-08-29 Thread Les De Ridder via Digitalmars-d-learn
On Thursday, 29 August 2019 at 15:10:26 UTC, rombankzero wrote: [...] Is this a bug, or am I missing something? It would be really convenient to be able to statically initialize rectangular arrays in this way. Example: I have a struct that has a member that's a rectangular float array, but I

Static initialization of rectangular arrays

2019-08-29 Thread rombankzero via Digitalmars-d-learn
Hey, everybody! I'm having Array Problems™. The documentation on arrays says that you can initialize all elements of a rectangular array with the following syntax: double[6][3] matrix = 0; // Sets all elements to 0. However this doesn't appear to work for static initialization: static