Re: aa bug?

2009-07-28 Thread Ary Borenszweig
Saaa escribió: struct S { int i; } S[char[]] aa; void main() { aa[test].i = 10; } Error: ArrayBoundsError D1.046 looks like a bug to me or can't structs be aa's? But you never inserted anything in aa[test]. You must do: S s; aa[test] = s; aa[test].i = 10; or: S s; s.i = 10; aa[test]

Re: aa bug?

2009-07-28 Thread Saaa
But you never inserted anything in aa[test]. You must do: S s; aa[test] = s; aa[test].i = 10; or: S s; s.i = 10; aa[test] = s; erm, ok Thanks So no creation on use :) Personally I find the declation step clutter in the first case. Maybe promote the bug to a request?

Re: aa bug?

2009-07-28 Thread Jarrett Billingsley
On Tue, Jul 28, 2009 at 6:09 PM, Saaaem...@needmail.com wrote: But you never inserted anything in aa[test]. You must do: S s; aa[test] = s; aa[test].i = 10; or: S s; s.i = 10; aa[test] = s; erm, ok Thanks So no creation on use :) Personally I find the declation step clutter in

Re: aa bug?

2009-07-28 Thread bearophile
Saaa: struct S { int i; } S[char[]] aa; void main() { aa[test].i = 10; } Error: ArrayBoundsError D1.046 Try: struct S { int i; } S[char[]] aa; void main() { aa[test] = S(10); } In theory a Sufficiently Smart Compiler is able to optimize that code well. Bye, bearophile

Re: aa bug?

2009-07-28 Thread Saaa
struct literals .. need to remember all D's features :) D1.046 seems SS aa[test]=S(); works fine as well Try: struct S { int i; } S[char[]] aa; void main() { aa[test] = S(10); } In theory a Sufficiently Smart Compiler is able to optimize that code well. Bye, bearophile