Catching std.conv.ConvException in readf causes a buffer overrun

2018-06-26 Thread Shigeki Karita via Digitalmars-d-learn
import std.stdio; import std.conv; void main() { int i; try { readf("%d\n", &i); // "a" } catch (ConvException e) { auto s = readln(); writeln(s); // "aa", "aaa" or SEGV ??? } } https://wandbox.org/permlink/NMYNjpOgQtfUprBQ I just want to retry reading if

Re: Catching std.conv.ConvException in readf causes a buffer overrun

2018-06-26 Thread Shigeki Karita via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 02:39:49 UTC, Shigeki Karita wrote: import std.stdio; import std.conv; void main() { int i; try { readf("%d\n", &i); // "a" } catch (ConvException e) { auto s = readln(); writeln(s); // "aa", "aaa" or SEGV ??? } } https://wan