What does exit(EXIT_FAILURE) do?
仅有的幸福
仅有的幸福 2017-05-31 10:38:51
0
1
1172

exit(EXIT_TRUE), does this:

1. Objects associated with the current thread with thread storage duration are destroyed (C++11 only).

2. Objects with static storage duration are destroyed (C++) and functions registered with atexit are called.

3. All C streams (open with functions in <cstdio>) are closed (and flushed, if buffered), and all files created with tmpfile are removed.
Control is returned to the host environment.

What about exit(EXIT_FAILURE)?

仅有的幸福
仅有的幸福

reply all(1)
滿天的星座

EXIT_SUCCESS and EXIT_FAILURE are two constants. Generally EXIT_SUCCESS=0, EXIT_FAILURE=1.

The

exit() function first handles many of the funeral matters you listed above, and finally returns its parameters to the operating system as exit status. So there is no difference in terms of the execution of the exit function itself. The difference is the operating system's interpretation of this exit status. Generally, 0 means the program has died, and 1 means it died unexpectedly.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template