On 6/11/2013 11:38 AM, Andrei Alexandrescu wrote:
On 6/11/13 1:01 PM, Lars T. Kyllingstad wrote:
On Tuesday, 11 June 2013 at 16:50:50 UTC, Andrei Alexandrescu wrote:
On 6/11/13 11:57 AM, Steven Schveighoffer wrote:
This code DOES fail:

import std.stdio;

int main()
{
writeln("hello");
std.stdio.stdout.flush();
return 0;
}

Ah, I suspected so. (At a point in D's history writeln() did do a
flush; people wanted to eliminate it for efficiency reasons.)

We could introduce a flush() with throw in std.stdiobase.

As in a module destructor? Isn't it better to let the error pass
silently rather than throwing an exception that can't be caught?

It will not be caught but will cause the entire program to print a diagnostic
and exit with a nonzero error code, which is useful.

The flush should be in the termination code (not in writeln), where it should 
throw.

Reply via email to