digitalmars.D.learn - passing non-dynamic arrays to variadic functions
- ketmar via Digitalmars-d-learn (21/21) Oct 26 2014 Hello.
- anonymous (6/21) Oct 26 2014 Prints
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/27) Oct 26 2014 Yeah, works with git head.
- ketmar via Digitalmars-d-learn (6/7) Oct 26 2014 On Sun, 26 Oct 2014 17:41:28 -0700
- ketmar via Digitalmars-d-learn (8/34) Oct 26 2014 On Mon, 27 Oct 2014 00:33:13 +0000
- MachineCode (6/32) Oct 26 2014 run
- ketmar via Digitalmars-d-learn (5/12) Oct 26 2014 On Mon, 27 Oct 2014 02:19:49 +0000
- MachineCode (4/18) Oct 26 2014 You're welcome :) what do you call git head is the dmd compiler
- ketmar via Digitalmars-d-learn (10/12) Oct 26 2014 On Mon, 27 Oct 2014 03:07:12 +0000
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 =3D "abc"; char[3] a1 =3D ['a', 'b', 'c']; doWrite(a0); doWrite(a1); } i don't know why, but this code prints complete garbage each time i run it. yet if i'll change `doWrite()` invocations to this: doWrite(a0[]); doWrite(a1[]); everything is working fine. am i doing something wrong in the first sample and missed the relevat part of documentation, or this is a bug? and do we have workaround for this?
Oct 26 2014
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 runPrints abc abc for me.
Oct 26 2014
On 10/26/2014 05:33 PM, anonymous wrote:On Monday, 27 October 2014 at 00:26:00 UTC, ketmar via Digitalmars-d-learn wrote:Yeah, works with git head. AliHello. 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 runPrints abc abc for me.
Oct 26 2014
On Sun, 26 Oct 2014 17:41:28 -0700 Ali =C3=87ehreli via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:Yeah, works with git head.ah, thank you. seems that one of the custom patches i'm using broke that. i just checked this on unpatched DMD, and it works too. sorry for the noise.
Oct 26 2014
On Mon, 27 Oct 2014 00:33:13 +0000 anonymous via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:On Monday, 27 October 2014 at 00:26:00 UTC, ketmar via Digitalmars-d-learn wrote: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.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 =3D "abc"; char[3] a1 =3D ['a', 'b', 'c']; doWrite(a0); doWrite(a1); } i don't know why, but this code prints complete garbage each=20 time i run=20 Prints abc abc for me.
Oct 26 2014
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 irunit. yet if i'll change `doWrite()` invocations to this: doWrite(a0[]); doWrite(a1[]); everything is working fine. am i doing something wrong in the first sample and missed the relevat part of documentation, or this is a bug? and do we have workaround for this?It worked fine for me. Output:abc abcEnvironment: Win 8.1 64-bit (but dmd target is 32-bit, IIRC), dmd v2.066.0
Oct 26 2014
On Mon, 27 Oct 2014 02:19:49 +0000 MachineCode via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:It worked fine for me. Output: =20yes, thank you too. that was one of my custom patches that broke this. i already found that patch, and it's not even mine! ;-)abc abc=20 Environment: Win 8.1 64-bit (but dmd target is 32-bit, IIRC), dmd=20 v2.066.0
Oct 26 2014
On Monday, 27 October 2014 at 02:27:32 UTC, ketmar via Digitalmars-d-learn wrote:On Mon, 27 Oct 2014 02:19:49 +0000 MachineCode via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:You're welcome :) what do you call git head is the dmd compiler compiled from dmd's source code on github?It worked fine for me. Output:yes, thank you too. that was one of my custom patches that broke this. i already found that patch, and it's not even mine! ;-)abc abcEnvironment: Win 8.1 64-bit (but dmd target is 32-bit, IIRC), dmd v2.066.0
Oct 26 2014
On Mon, 27 Oct 2014 03:07:12 +0000 MachineCode via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:You're welcome :) what do you call git head is the dmd compiler=20 compiled from dmd's source code on github?yes. i'm updating my compiler on dayly basis, so my "git head" is really "head". ;-) but i also have alot of custom patches applied to it (some not-yet-accepted PRs, my internal patches that will never made into mainline and so on). usually i'm trying to reproduce the bug with "vanilla" DMD, but this time i was so sure that it's in vanilla too that i didn't bother to check. my bad.
Oct 26 2014