Andrei Alexandrescu wrote:
I can't reproduce the bug, code works for me with 2.047 on Linux. Here's the relevant code:

void writeln(T...)(T args)
if (T.length == 1 && is(typeof(args[0]) : const(char)[]))
{
    enforce(fprintf(.stdout.p.handle, "%*s\n",
        args[0].length, args[0].ptr) >= 0);
}

What is wrong with it?



The %*s should be %.*s

Also, the format will still stop anyway on encountering a 0 byte. Then, there's the overhead of fprintf itself. Better to just replace the thing with a call to fwrite:

enforce(fwrite(args[0].ptr, T.sizeof, args[0].length, .stdout.p.handle) == args[0].length);


_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to