digitalmars.D.bugs - [Issue 4656] New: stdio.readf does not ignore white space
- d-bugmail puremagic.com (31/31) Aug 16 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4656
- d-bugmail puremagic.com (10/10) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4656
- d-bugmail puremagic.com (22/22) May 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4656
- d-bugmail puremagic.com (15/15) May 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4656
- d-bugmail puremagic.com (11/11) May 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4656
- d-bugmail puremagic.com (14/14) Apr 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4656
http://d.puremagic.com/issues/show_bug.cgi?id=4656 Summary: stdio.readf does not ignore white space Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: acehreli yahoo.com This makes it very difficult to read values. We can't retire din.readf before fixing this. import std.stdio; void main() { int i, j; readf("%s", &i); readf("%s", &j); } Run the program and provide the following as input: 42 43 The program terminates with std.conv.ConvError: std.conv(1070): Can't convert value `LockingTextReader(File(807637C), )' of type LockingTextReader to type int The reason is the white space. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4656 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4656 09:18:02 PDT --- This is by design. The example works when modified as follows: import std.stdio; void main() { int i, j; readf("%s", &i); readf(" %s", &j); } The space before the second parameter tells readf to read and skip all whitespace before attempting conversion. I've implemented readf to be a fair amount more Nazi about whitespace than scanf in an attempt to improve its precision. Scanf has been famously difficult to use for complex input parsing and validation, and I attribute some of that to its laissez-faire attitude toward whitespace. I'd be glad to relax some of readf's insistence on precise whitespace handling if there's enough evidence that that serves most of our users. I personally believe that the current behavior (strict by default, easy to relax) is best. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4656 Ali Cehreli <acehreli yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |INVALID My apologies for forgetting about this bug report. I have since then replaced din and dout with stdin and stdout in D.ershane. The nazi whitespace behaviour worked correctly and consistently in all of the examples. Thank you, Ali -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4656 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | 11:27:57 PDT --- Let's keep it opened until the error message is fixed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4656 SomeDude <lovelydear mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear mailmetrash.com PDT --- The original test case now produces this message: PS E:\DigitalMars\dmd2\samples> rdmd bug.d 456 45646 std.conv.ConvException E:\DigitalMars\dmd2\windows\bin\..\..\src\phobos\std\conv.d(1779): Unexpected ' ' when converting from type LockingTextReader to type int -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 21 2012