www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21741] New: std.format: %0*d produces int.max zeros

https://issues.dlang.org/show_bug.cgi?id=21741

          Issue ID: 21741
           Summary: std.format: %0*d produces int.max zeros
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bugzilla bernis-buecher.de

Taken from https://issues.dlang.org/show_bug.cgi?id=15386:

Not only the 'internal' ones, but also from public functions, this issue can be
reproduced:

void main()
{
    import std.stdio;
    "%(%0*d%)".writefln(new int[1]);
}

I intended to specify equal width for each element of an array, put the width
before new int[1] and got a runtime error. Removing the width from the
arguments, I've come up with this code.

--
Mar 21