Thread overview
continued: Bug or what?
Nov 14, 2005
Tomás Rossi
Nov 14, 2005
Regan Heath
Nov 14, 2005
Dave
November 14, 2005
Also, writefln or writef("\n") doesn't seems to suffer from this.
Setting a writefln("") just before the pause call fixes all.
Maybe it has something to do with the newline. Neglecting to flush until a
newline?


Tom
November 14, 2005
On Mon, 14 Nov 2005 03:09:30 +0000 (UTC), Tomás Rossi <Tomás_member@pathlink.com> wrote:
> Also, writefln or writef("\n") doesn't seems to suffer from this.
> Setting a writefln("") just before the pause call fixes all.
> Maybe it has something to do with the newline. Neglecting to flush until a newline?

I suspect the buffer flushes on a newline, so the writef goes into the buffer but isn't flushed, then, I suspect the pause text doesn't go into the buffer but straight to the console. So it gets there before the buffered text.

Regan
November 14, 2005
In article <opsz7n250r23k2f5@nrage.netwin.co.nz>, Regan Heath says...
>
>On Mon, 14 Nov 2005 03:09:30 +0000 (UTC), Tomás Rossi <Tomás_member@pathlink.com> wrote:
>> Also, writefln or writef("\n") doesn't seems to suffer from this.
>> Setting a writefln("") just before the pause call fixes all.
>> Maybe it has something to do with the newline. Neglecting to flush until
>> a newline?
>
>I suspect the buffer flushes on a newline, so the writef goes into the buffer but isn't flushed, then, I suspect the pause text doesn't go into the buffer but straight to the console. So it gets there before the buffered text.
>
>Regan

The 'terminal' IO library routines underlying phobos will flush on a newline or close by default for both Windows and Linux.

So it isn't strictly a bug unless it's defined otherwise. This default behaviour can be changed by using std.c.stdio.setvbuf(...);