On 6/12/13 11:59 AM, Walter Bright wrote:
On 6/12/2013 5:30 AM, Andrei Alexandrescu wrote:
On 6/11/13 11:42 PM, Walter Bright wrote:
I think you meant "just flush once after using the FILE * for the
first time"

I think it's a bad idea, it'll muck up the buffering (i.e. make it
slower).

The fix is when main() returns to do the flush there.

I agree. One question is, should we flush all buffers upon termination?
fflush(null) would do so.
http://www.gnu.org/software/libc/manual/html_node/Flushing-Buffers.html

I haven't heard about the fflush(null) thing. That may be gnu-specific.
I don't think that works on Windows.

It's quite an old standard feature albeit obscure, I found it and forgot about it a couple of times already. Works everywhere, see http://www.cplusplus.com/reference/cstdio/ferror/ and http://msdn.microsoft.com/en-us/library/9yky46tz(v=vs.80).aspx

But yes, all open files should be flushed on termination. It's what C's
stdio does already.

http://d.puremagic.com/issues/show_bug.cgi?id=10344


Andrei

Reply via email to