www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17281] New: std.format.format should not allow nonsensical

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

          Issue ID: 17281
           Summary: std.format.format should not allow nonsensical format
                    specifiers
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: hsteoh quickfur.ath.cx

Currently, the documentation for std.format.format states that specifiers
consist of '%' followed by optional Position, optional Flags, optional Width,
optional Precision, and finally the format character.

However, the actual implementation is far more lax, and allows nonsensical
specifiers such as the following:

------
import std.stdio;
void main() {
        writefln("%3+-.3#-+-.3---+++###s", "WAT");
}
------

The implementation ought to be cleaned up to reject such nonsensical format
strings.

--
Mar 28