http://d.puremagic.com/issues/show_bug.cgi?id=8730


Andrej Mitrovic <andrej.mitrov...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrov...@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2012-10-04 
17:11:33 PDT ---
I'm just guessing, but:

void writeln(T...)(T args)
{
    static if (T.length == 0)
    {
        enforce(fputc('\n', .stdout.p.handle) == '\n');
    }
    else static if (T.length == 1 &&
                    is(typeof(args[0]) : const(char)[]) &&
                    !is(typeof(args[0]) == enum) && !is(typeof(args[0]) ==
typeof(null)) &&
                    !isAggregateType!(typeof(args[0])))
    {
        // Specialization for strings - a very frequent case
        enforce(fprintf(.stdout.p.handle, "%.*s\n",
                        cast(int) args[0].length, args[0].ptr) >= 0);
    }
    else
    {
        // Most general instance
        stdout.write(args, '\n');
    }
}

The specialization is probably to blame. I think 'args[0].length' probably sets
the max limit rather than min, but I don't know enough about fprintf internals.
:)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to