[Issue 8910] Static arrays, dynamic arrays and std.array.join
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 30 14:21:42 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8910
--- Comment #17 from Daniel Cousens <daniel350 at bigpond.com> 2012-10-30 14:21:40 PDT ---
(In reply to comment #15)
> (In reply to comment #14)
> > (In reply to comment #11)
> > > ...
> > > map!(c => c[])(cs[]).join(",");
> > > ...
> >
> > This is not valid.
>
> Huh. So it isn't, it compiles however, just garbage output.
> What *is* it doing differently?
>
> Also, thanks for bearing with me on this Jonathan M Davis, you're explanation
> has been a great helping in understanding the problem. :)
Right, so it is passing in a random static array of char[5] into the function,
which contains garbage.
By doing `char[] j = map!((char[] c) => c)(cs[]).join(",");`, you are forcing
the template input to be a char[], which has implicit casting, and therefore
returns a slice (note, AFAIK the second slice wasn't necessary on c).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list