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



--- Comment #1 from Andrei Alexandrescu <and...@metalanguage.com> 2011-05-09 
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: -------

Reply via email to