www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12260] New: Improve error of std.stdio.readf when involving whitespace

https://d.puremagic.com/issues/show_bug.cgi?id=12260

           Summary: Improve error of std.stdio.readf when involving
                    whitespace
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: Jesse.K.Phillips+D gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D gmail.com> 2014-02-25
19:56:51 PST ---
The following program will throw an exception on the second read.

------
void main()
{
    import std.stdio;
    int input;
    readf("%s", &input);
    readf("%s", &input);
}
------

The exceptions message points out the remaining newline from the first input:

--------
conv.d(1901): Unexpected '
' when converting from type LockingTextReader to type int
--------

It should probably convert whitespace into a more recognizable form:

-------
conv.d(1901): Unexpected '\n' when converting from type LockingTextReader to
type int
-------

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