On 7/26/17 10:30 PM, FatalCatharsis wrote:
On Thursday, 27 July 2017 at 01:21:40 UTC, Steven Schveighoffer wrote:
the writeln("start"); and writeln("end"); in main. This is what I meant by printing. These do not appear in the output. The programs starts and immediately ends without printing "start" and "end".

try flushing the output. In some cases the output streams do not flush on newlines.

I did not put an output in the exception handler of the WndProc because writeln can throw and the function is marked nothrow. All I as trying to do there was get it to recover.

Just surround writeln with try/catch(Exception), should work.

You could also just use good old printf.


This appears to be it. When an error is thrown, stdout does not flush. When I put stdout.flush() immediately after the writeln("start") at the beginning it is printed correctly. However, when I try to catch the error and then do stdout.flush() in main, it does not print.

Do you know of a way to make D always flush the output buffer when an error is thrown?

Are you sure the error is being caught? I thought the event loop was run in a separate thread. Not sure, because I don't do windows development.

Try catching the error right in the event handler.

-Steve

Reply via email to