EXIT_SUCCESS, EXIT_FAILURE
From cppreference.com
C++
Utilities library
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Program support utilities
| Program termination | ||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||
| Unreachable control flow | ||||||||||||||||||||||||||||||||||||
|
(C++23)
|
||||||||||||||||||||||||||||||||||||
| Communicating with the environment | ||||||||||||||||||||||||||||||||||||
| Signals | ||||||||||||||||||||||||||||||||||||
| Signal types | ||||||||||||||||||||||||||||||||||||
| Non-local jumps | ||||||||||||||||||||||||||||||||||||
| Types | ||||||||||||||||||||||||||||||||||||
Defined in header <cstdlib>
|
||
#define EXIT_SUCCESS /*implementation defined*/ |
||
#define EXIT_FAILURE /*implementation defined*/ |
||
The EXIT_SUCCESS and EXIT_FAILURE macros expand into integral constant expressions that can be used as arguments to the std::exit function (and, therefore, as the values to return from the main function
A freestanding implementation is required to provide |
(since C++23) |
| Constant | Description |
EXIT_SUCCESS
|
successful execution of a program |
EXIT_FAILURE
|
unsuccessful execution of a program |
Notes
Both EXIT_SUCCESS and the value zero indicate successful program execution status (see std::exit), although it is not required that EXIT_SUCCESS
Although EXIT_SUCCESS and EXIT_FAILURE are required to be freestanding since C++23, they are not required to be available in a freestanding C implementation.
Example
Run this code
Possible output:
The quick brown fox jumps over the lazy cat
See also
|
C documentation for EXIT_SUCCESS, EXIT_FAILURE
|