What\'s the difference between those three, and how shall I end program in case of exception which I can\'t handle properly?
quick_exit() !
If your program is multi-threaded, then calling exit()
will most likely result in a crash because global/static std::thread
objects will be attempted to destruct without exiting their threads.
If you want to return an error code and exit the program (more or less) normally, call quick_exit()
in multi-threaded programs.
For abnormal termination (without a possibility for you to specify the error code), abort()
or std::terminate()
can be called.
Note: quick_exit() has not been supported by MSVC++ until version 2015 .