[Issue 15293] [REG2.069.0] std.stdio.readln(buffer) messes up buffer's capacity

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Nov 12 10:16:41 PST 2015


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

--- Comment #13 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to ag0aep6g from comment #12)

> It also only affects naive readln calls on Windows. byLine is already
> cautious about what exactly it gives readln as a buffer, so it shouldn't get
> slower. And on other OSs readnl already does the excessive allocations.

I think you're right. It seems that the naive loop is simply bad code, and we
shouldn't cater to it. It also makes using a stack buffer as a starting point
very unwieldy. Since byLine is no longer affected by such a change, I think we
should do it. There is already an example in the code to show how to properly
use readln in a loop (added as a result of the previous update).

Thanks

--


More information about the Digitalmars-d-bugs mailing list