Re: auto with array of strings (BUG?)

2009-08-20 Thread bearophile
Justin: >Is there a reason that the compiler makes the assumptions it does or is this a >bug? I did try searching the bugzilla with a few different queries, but failed >to turn up anything that looked likely.< I don't know if it can be considered a bug, or just a design error. What I know is t

Re: auto with array of strings (BUG?)

2009-08-19 Thread BCS
Reply to Jarrett, On Wed, Aug 19, 2009 at 7:01 PM, Justin wrote: I was writing some unittests when I ran across some rather unexpected behavior in which strings in an array were being trimmed to the length of the first element. Running this program: import std.stdio; void main() { auto string

Re: auto with array of strings (BUG?)

2009-08-19 Thread Jarrett Billingsley
On Wed, Aug 19, 2009 at 7:20 PM, Justin wrote: > Jarrett Billingsley Wrote: >> There's two annoying things going on here: >> >> 1) The type of string literals is not char[], it's char[n] where n is >> the length of the string.  I don't know why this is. >> 2) With array literals, the compiler simpl

Re: auto with array of strings (BUG?)

2009-08-19 Thread Justin
Jarrett Billingsley Wrote: > There's two annoying things going on here: > > 1) The type of string literals is not char[], it's char[n] where n is > the length of the string. I don't know why this is. > 2) With array literals, the compiler simply determines the type of the > array as being a dynam

Re: auto with array of strings (BUG?)

2009-08-19 Thread Jarrett Billingsley
On Wed, Aug 19, 2009 at 7:01 PM, Justin wrote: > I was writing some unittests when I ran across some rather unexpected > behavior in which strings in an array were being trimmed to the length of the > first element. Running this program: > > import std.stdio; > void main() { >        auto strings

auto with array of strings (BUG?)

2009-08-19 Thread Justin
I was writing some unittests when I ran across some rather unexpected behavior in which strings in an array were being trimmed to the length of the first element. Running this program: import std.stdio; void main() { auto strings = ["hello", "cruelly", "innovative", "world"]; wri