Skip to content

Commit 93d2453

Browse files
author
Colin Robertson
committed
Fix cpp-doc issue #27
1 parent 79b60d6 commit 93d2453

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

docs/c-runtime-library/reference/exit-exit-exit.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void _exit(
8787
## Remarks
8888
The `exit`, `_Exit` and `_exit` functions terminate the calling process. The `exit` function calls destructors for thread-local objects, then calls—in last-in-first-out (LIFO) order—the functions that are registered by `atexit` and `_onexit`, and then flushes all file buffers before it terminates the process. The `_Exit` and `_exit` functions terminate the process without destroying thread-local objects or processing `atexit` or `_onexit` functions, and without flushing stream buffers.
8989

90-
Although the `exit`, `_Exit` and `_exit` calls do not return a value, the low-order byte of `status` is made available to the host environment or waiting calling process, if one exists, after the process exits. Typically, the caller sets the `status` value to 0 to indicate a normal exit, or to some other value to indicate an error. The `status` value is available to the operating-system batch command `ERRORLEVEL` and is represented by one of two constants: `EXIT_SUCCESS`, which represents a value of 0, or `EXIT_FAILURE`, which represents a value of 1.
90+
Although the `exit`, `_Exit` and `_exit` calls do not return a value, the value in `status` is made available to the host environment or waiting calling process, if one exists, after the process exits. Typically, the caller sets the `status` value to 0 to indicate a normal exit, or to some other value to indicate an error. The `status` value is available to the operating-system batch command `ERRORLEVEL` and is represented by one of two constants: `EXIT_SUCCESS`, which represents a value of 0, or `EXIT_FAILURE`, which represents a value of 1.
9191

9292
The `exit`, `_Exit`, `_exit`, `quick_exit`, `_cexit`, and `_c_exit` functions behave as follows.
9393

@@ -100,13 +100,18 @@ void _exit(
100100
|`_cexit`|Performs complete C library termination procedures and returns to the caller. Does not terminate the process.|
101101
|`_c_exit`|Performs minimal C library termination procedures and returns to the caller. Does not terminate the process.|
102102

103-
When you call the `exit`, `_Exit` or `_exit` function, the destructors for any temporary or automatic objects that exist at the time of the call are not called. An automatic object is defined in a function where the object is not declared to be static. A temporary object is an object that's created by the compiler. To destroy an automatic object before you call `exit`, `_Exit`, or `_exit`, explicitly call the destructor for the object, as follows:
103+
When you call the `exit`, `_Exit` or `_exit` function, the destructors for any temporary or automatic objects that exist at the time of the call are not called. An automatic object is a non-static local object defined in a function. A temporary object is an object that's created by the compiler, such as a value returned by a function call. To destroy an automatic object before you call `exit`, `_Exit`, or `_exit`, explicitly call the destructor for the object, as shown here:
104104

105-
```
106-
myObject.myClass::~myClass();
105+
```cpp
106+
void last_fn() {}
107+
struct SomeClass {} myInstance{};
108+
// ...
109+
myInstance.~SomeClass(); // explicit destructor call
110+
exit(0);
111+
}
107112
```
108113
109-
Do not use `DLL_PROCESS_ATTACH` to call `exit` from `DllMain`. If you want to exit the `DLLMain` function, return `FALSE` from `DLL_PROCESS_ATTACH`.
114+
Do not use `DLL_PROCESS_ATTACH` to call `exit` from `DllMain`. To exit the `DLLMain` function, return `FALSE` from `DLL_PROCESS_ATTACH`.
110115
111116
## Requirements
112117
@@ -118,7 +123,7 @@ myObject.myClass::~myClass();
118123
119124
## Example
120125
121-
```
126+
```C
122127
// crt_exit.c
123128
// This program returns an exit code of 1. The
124129
// error code could be tested in a batch file.

0 commit comments

Comments
 (0)