passing non-dynamic arrays to variadic functions
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 26 17:42:23 PDT 2014
On Mon, 27 Oct 2014 00:33:13 +0000
anonymous via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:
> On Monday, 27 October 2014 at 00:26:00 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > Hello.
> >
> > let's assume we have this code:
> >
> > void doWrite(A...) (A args) {
> > import std.stdio;
> > import std.conv;
> > writeln(to!string(args[0]));
> > }
> >
> > void main () {
> > char[3] a0 = "abc";
> > char[3] a1 = ['a', 'b', 'c'];
> > doWrite(a0);
> > doWrite(a1);
> > }
> >
> > i don't know why, but this code prints complete garbage each
> > time i run
>
> Prints
> abc
> abc
> for me.
ah, i forgot to specify my system:
GNU/Linux, x86, DMD git head. could you please test this with current
git?
it seems to work with GDC, which is 2.065 for now. seems that this is a
regression.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141027/90b712a8/attachment.sig>
More information about the Digitalmars-d-learn
mailing list