我有一个像这样的静态构造函数:
File errorLog; static this() { try { errorLog = File("./log/log.txt", "w"); } catch(Throwable ex) { // STOP PROGRAM EXECUTION } }
当文件打开失败时,如何停止程序执行?
使用core.runtime终止druntime http://dlang.org/phobos/core_runtime.html#.Runtime.terminate并退出core.stdc.stdlib
1 回答
使用core.runtime终止druntime http://dlang.org/phobos/core_runtime.html#.Runtime.terminate并退出core.stdc.stdlib