Does immutable(char)[] have any advantage over const(char)[] for function parameters?

2009-07-28 Thread Trass3r
I currently almost always use const(char)[] for function parameters to make it possible to also pass char[] strings to the function. Are there any disadvantages like optimization issues?

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

confused about scope storage class

2009-07-28 Thread Trass3r
So scope for class references guarantees that the destructor is called upon leaving the scope (why isn't this done automatically?). But what if scope is used with basic types like scope int x; What's the effect?

D1 vs D2 Feature comparison list

2009-07-28 Thread Sam Hu
Is there such stuff available in D website? Or the only choice to quick check what features are supported by D2 also supported by D1 is to go through the spec? Thanks in advance. Regards, Sam

Re: confused about scope storage class

2009-07-28 Thread Jarrett Billingsley
On Tue, Jul 28, 2009 at 10:46 PM, Trass3rmrmoc...@gmx.de wrote: So scope for class references guarantees that the destructor is called upon leaving the scope (why isn't this done automatically?). Why isn't what done automatically? But what if scope is used with basic types like scope int x;

Re: D1 vs D2 Feature comparison list

2009-07-28 Thread Jarrett Billingsley
On Tue, Jul 28, 2009 at 11:11 PM, Sam Husamhudotsa...@gmail.com wrote: Is there such stuff available in D website? Or the only choice to quick   check what features are supported by D2 also supported by D1 is to go through the spec? Thanks in advance. Regards, Sam

Re: D1 vs D2 Feature comparison list

2009-07-28 Thread Sam Hu
Jarrett Billingsley Wrote: http://www.digitalmars.com/d/2.0/features2.html Thank you so much.So silly a question :P