Wrong lowering for a[b][c]++

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Mar 23 13:56:39 PDT 2012


On 3/23/12, Timon Gehr <timon.gehr at gmx.ch> wrote:
> It creates an array from key-value pairs. a[1] will be 2 and a[3] will
> be 4. Unspecified entries are default-initialized. It can be quite
> useful for building lookup tables.

Interesting. It's documented under "Static Initialization of
Statically Allocated Arrays", but I guess it works for dynamic arrays
too. I could use these for sure. :)

> Another reason why array initializers are different from array literals:
> struct S{int a,b,c;}
> S[] sarr = [{a: 1, b: 2, c: 3}, {a: 4, b: 5, c: 6}];

Yeah I knew about those, although IIRC these might be deprecated?


More information about the Digitalmars-d mailing list