Unexpected Crash

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 7 14:22:19 PDT 2016


On 04/07/2016 01:49 PM, default0 wrote:
> On Thursday, 7 April 2016 at 20:47:35 UTC, Adam D. Ruppe wrote:
>> On Thursday, 7 April 2016 at 20:42:17 UTC, default0 wrote:
>>> If I enter "5,5,5" on the commandline, hit enter, then enter "5,5,5"
>>
>>
>> When you hit enter, that puts a \n character in the buffer. readf
>> doesn't skip that automatically, so it complains upon hitting that
>> newline (the error message shows the character *after* it though,
>> which sucks).
>>
>>
>> But what you want to do is to read whitespace too. I think putting a
>> space in the format string at the beginning or end will do it (I don't
>> use readf often though).
>
> Changing the format string to "%d,%d,%d\n" fixed the problem. Would've
> figured if the error complained about '\n' instead of '5'.

Which compiler version? This is fixed:

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

It's now better but \n may be hard to decode from the following message:

std.conv.ConvException@/usr/include/dmd/phobos/std/conv.d(2002): 
Unexpected '
' when converting from type LockingTextReader to type int

Ali



More information about the Digitalmars-d-learn mailing list