[Issue 15297] New: std.stdio readf cryptic error message
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Nov 6 06:41:39 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15297
Issue ID: 15297
Summary: std.stdio readf cryptic error message
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: pastuhov85 at gmail.com
Consider this small example:
import std.stdio;
void main() {
int a;
readf("%s", &a);
writeln("a now is ", a);
}
If we compile and run it and then feed it some wrong (non-integer) input,
program crashes and error message looks like this:
std.conv.ConvException@/usr/include/dmd/phobos/std/conv.d(1998): Unexpected '
' when converting from type LockingTextReader to type int
----------------
??:? int std.conv.parse!(int, std.stdio.LockingTextReader).parse(ref
std.stdio.LockingTextReader) [0x440857]
??:? int std.conv.parse!(int, std.stdio.LockingTextReader).parse(ref
std.stdio.LockingTextReader, uint) [0x440567]
??:? int std.format.unformatValue!(int, std.stdio.LockingTextReader,
char).unformatValue(ref std.stdio.LockingTextReader, ref
std.format.FormatSpec!(char).FormatSpec) [0x43fdc2]
??:? uint std.format.formattedRead!(std.stdio.LockingTextReader, char,
int*).formattedRead(ref std.stdio.LockingTextReader, const(char)[], int*)
[0x43cdd7]
??:? uint std.stdio.File.readf!(int*).readf(const(char[]), int*) [0x43cd32]
??:? uint std.stdio.readf!(int*).readf(const(char[]), int*) [0x43cc67]
??:? _Dmain [0x43cc27]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x448aca]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x448a20]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll() [0x448a86]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x448a20]
??:? _d_run_main [0x44897d]
??:? main [0x444695]
??:? __libc_start_main [0x2b01360f]
It's weird and absolutely uninformative.
I suppose question marks (?) are meant to be row:column numbers?
--
More information about the Digitalmars-d-bugs
mailing list