std.c.stdlib.exit() seems to break RAII. The code below tests this both using a struct destructor and an explicit scope(exit) {}. Is this an intentional feature or a bug?
import std.stdio; import std.c.stdlib; void main() { struct SafeExit { ~this() { writeln("Safely exit with destructor."); } } SafeExit safeExit; scope(exit) { writeln("Safely exit with scope(exit)."); } scope(failure) { writeln("Safely exit with scope(failure)."); } writeln("Test if std.c.stdlib.exit() breaks RAII."); writeln("Pre-exit!"); std.c.stdlib.exit(0); writeln("Post-exit! Should not get here!"); }