Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Rust

Idiom #198 Abort program execution with error condition

Abort program execution with error condition x (where x is an integer value)

use std::process;
process::exit(x);

This does not run any destructors. Clean up is left to the OS.
#include <stdlib.h>
exit(x);

Calls all functions registered with atexit, then flushes and closes all streams and finally terminates the process.

New implementation...
< >
Bart