Skip to content

Commit 77dd100

Browse files
authored
Merge pull request #270 from Microsoft/cr-started
Fix a couple of reported issues
2 parents 02ec2e7 + 942f80e commit 77dd100

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
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.

docs/error-messages/compiler-errors-1/fatal-error-c1052.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ translation.priority.ht:
3434
- "zh-cn"
3535
- "zh-tw"
3636
---
37-
# Fatal Error C1052
38-
program database file, '*filename*', was generated by the linker with /DEBUG:fastlink; compiler cannot update such PDB files; please delete it or use /Fd to specify a different PDB filename
37+
# Fatal Error C1052
38+
39+
> program database file, '*filename*', was generated by the linker with /DEBUG:fastlink; compiler cannot update such PDB files; please delete it or use /Fd to specify a different PDB filename
3940
4041
The compiler cannot update the same program database (PDB) files which are generated by the linker when the [/DEBUG:fastlink](../../build/reference/debug-generate-debug-info.md) option is specified. Normally the compiler-generated PDB files and the linker-generated PDB files have different names. However, if they are set to use the same names, this error can result.
4142

42-
To fix this issue, you can explicitly delete the PDB files before you compile again, or you can create different names for the compiler-generated and linker-generated PDB files. To create different compiler-generated PDB file names on the command line, use the [/Fd](../../build/reference/fd-program-database-file-name.md) option. To generate different PDB file names in the IDE, open the **Property Pages** dialog for your project, and in the **Configuration Properties**, **C/C++**, **Output Files** page, set the **Program Database File Name** property. By default, this property is `$(IntDir)vc$(PlatformToolsetVersion).pdb`. Alternatively, you can set the linker-generated PDB file name. Open the **Property Pages** dialog for your project, and in the **Configuration Properties**, **Linker**, **Debugging** page, set the **Generate Program Database File** property. By default, this property is set to `$(OutDir)$(TargetName).pdb`.
43+
To fix this issue, you can explicitly delete the PDB files before you compile again, or you can create different names for the compiler-generated and linker-generated PDB files.
44+
45+
To specify the compiler-generated PDB file name on the command line, use the [/Fd](../../build/reference/fd-program-database-file-name.md) compiler option. To specify the compiler-generated PDB file name in the IDE, open the **Property Pages** dialog for your project, and in the **Configuration Properties**, **C/C++**, **Output Files** page, set the **Program Database File Name** property. By default, this property is `$(IntDir)vc$(PlatformToolsetVersion).pdb`.
46+
47+
Alternatively, you can set the linker-generated PDB file name. To specify the linker-generated PDB file name on the command line, use the [/PDB](../../build/reference/pdb-use-program-database.md) linker option. To specify the linker-generated PDB file name in the IDE, open the **Property Pages** dialog for your project, and in the **Configuration Properties**, **Linker**, **Debugging** page, set the **Generate Program Database File** property. By default, this property is set to `$(OutDir)$(TargetName).pdb`.

0 commit comments

Comments
 (0)