You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 18ee232
Browse filesBrowse the repository at this point in the historyBrowse files
Terminates a thread; **_endthread** terminates a thread that's created by **_beginthread** and **_endthreadex** terminates a thread that's created by **_beginthreadex**.
14
+
Terminates a thread; **`_endthread`** terminates a thread that's created by **`_beginthread`** and **`_endthreadex`** terminates a thread that's created by **`_beginthreadex`**.
16
15
17
16
## Syntax
18
17
@@ -25,31 +24,31 @@ void _endthreadex(
25
24
26
25
### Parameters
27
26
28
-
*retval*<br/>
27
+
*`retval`*\
29
28
Thread exit code.
30
29
31
30
## Remarks
32
31
33
-
You can call **_endthread** or **_endthreadex** explicitly to terminate a thread; however, **_endthread** or **_endthreadex** is called automatically when the thread returns from the routine passed as a parameter to **_beginthread** or **_beginthreadex**. Terminating a thread with a call to **endthread** or **_endthreadex** helps ensure proper recovery of resources allocated for the thread.
32
+
You can call **`_endthread`** or **`_endthreadex`** explicitly to terminate a thread; however, **`_endthread`** or **`_endthreadex`** is called automatically when the thread returns from the routine passed as a parameter to **`_beginthread`** or **`_beginthreadex`**. Terminating a thread with a call to **`endthread`** or **`_endthreadex`** helps ensure proper recovery of resources allocated for the thread.
34
33
35
34
> [!NOTE]
36
-
> For an executable file linked with Libcmt.lib, do not call the Win32 [ExitThread](/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitthread) API; this prevents the run-time system from reclaiming allocated resources. **_endthread** and **_endthreadex** reclaim allocated thread resources and then call **ExitThread**.
35
+
> For an executable file linked with Libcmt.lib, do not call the Win32 [`ExitThread`](/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitthread) API; this prevents the run-time system from reclaiming allocated resources. **`_endthread`** and **`_endthreadex`** reclaim allocated thread resources and then call **`ExitThread`**.
37
36
38
-
**_endthread** automatically closes the thread handle. (This behavior differs from the Win32 **ExitThread** API.) Therefore, when you use **_beginthread** and **_endthread**, do not explicitly close the thread handle by calling the Win32 [CloseHandle](/windows/win32/api/handleapi/nf-handleapi-closehandle) API.
37
+
**`_endthread`** automatically closes the thread handle. (This behavior differs from the Win32 **`ExitThread`** API.) Therefore, when you use **`_beginthread`** and **`_endthread`**, don't explicitly close the thread handle by calling the Win32 [`CloseHandle`](/windows/win32/api/handleapi/nf-handleapi-closehandle) API.
39
38
40
-
Like the Win32 **ExitThread** API, **_endthreadex**does not close the thread handle. Therefore, when you use **_beginthreadex** and **_endthreadex**, you must close the thread handle by calling the Win32 **CloseHandle** API.
39
+
Like the Win32 **`ExitThread`** API, **`_endthreadex`**doesn't close the thread handle. Therefore, when you use **`_beginthreadex`** and **`_endthreadex`**, you must close the thread handle by calling the Win32 **`CloseHandle`** API.
41
40
42
41
> [!NOTE]
43
-
> **_endthread** and **_endthreadex** cause C++ destructors pending in the thread not to be called.
42
+
> **`_endthread`** and **`_endthreadex`** cause C++ destructors pending in the thread not to be called.
44
43
45
44
By default, this function's global state is scoped to the application. To change this, see [Global state in the CRT](../global-state.md).
46
45
47
46
## Requirements
48
47
49
48
|Function|Required header|
50
49
|--------------|---------------------|
51
-
|**_endthread**|\<process.h>|
52
-
|**_endthreadex**|\<process.h>|
50
+
|**`_endthread`**|`<process.h>`|
51
+
|**`_endthreadex`**|`<process.h>`|
53
52
54
53
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
55
54
@@ -59,9 +58,9 @@ Multithreaded versions of the [C run-time libraries](../../c-runtime-library/crt
59
58
60
59
## Example
61
60
62
-
See the example for [_beginthread](beginthread-beginthreadex.md).
61
+
See the example for [`_beginthread`](beginthread-beginthreadex.md).
63
62
64
63
## See also
65
64
66
-
[Process and Environment Control](../../c-runtime-library/process-and-environment-control.md)<br/>
Returns 0 if the file-status information is obtained. A return value of -1 indicates an error. If the file descriptor is invalid or *buffer* is **NULL**, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, **errno** is set to **EBADF**, in the case of an invalid file descriptor, or to **EINVAL**, if *buffer* is **NULL**.
55
+
Returns 0 if the file-status information is obtained. A return value of -1 indicates an error. If the file descriptor is invalid or *`buffer`* is **`NULL`**, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, **`errno`** is set to **`EBADF`**, in the case of an invalid file descriptor, or to **`EINVAL`**, if *`buffer`* is **`NULL`**.
57
56
58
57
## Remarks
59
58
60
-
The **_fstat** function obtains information about the open file associated with *fd* and stores it in the structure pointed to by *buffer*. The **_stat** structure, defined in SYS\Stat.h, contains the following fields.
59
+
The **`_fstat`** function obtains information about the open file associated with *`fd`* and stores it in the structure pointed to by *`buffer`*. The **`_stat`** structure, defined in `SYS\Stat.h`, contains the following fields.
61
60
62
61
|Field|Meaning|
63
62
|-|-|
64
-
|**st_atime**| Time of the last file access. |
65
-
|**st_ctime**| Time of the creation of the file. |
66
-
|**st_dev**| If a device, *fd*; otherwise 0. |
67
-
|**st_mode**| Bit mask for file-mode information. The **_S_IFCHR** bit is set if *fd* refers to a device. The **_S_IFREG** bit is set if *fd* refers to an ordinary file. The read/write bits are set according to the file's permission mode. **_S_IFCHR** and other constants are defined in SYS\Stat.h. |
68
-
|**st_mtime**| Time of the last modification of the file. |
69
-
|**st_nlink**| Always 1 on non-NTFS file systems. |
70
-
|**st_rdev**| If a device, *fd*; otherwise 0. |
71
-
|**st_size**| Size of the file in bytes. |
63
+
|**`st_atime`**| Time of the last file access. |
64
+
|**`st_ctime`**| Time of the creation of the file. |
65
+
|**`st_dev`**| If a device, *`fd`*; otherwise 0. |
66
+
|**`st_mode`**| Bit mask for file-mode information. The **`_S_IFCHR`** bit is set if *`fd`* refers to a device. The **`_S_IFREG`** bit is set if *`fd`* refers to an ordinary file. The read/write bits are set according to the file's permission mode. **`_S_IFCHR`** and other constants are defined in `SYS\Stat.h`. |
67
+
|**`st_mtime`**| Time of the last modification of the file. |
68
+
|**`st_nlink`**| Always 1 on non-NTFS file systems. |
69
+
|**`st_rdev`**| If a device, *`fd`*; otherwise 0. |
70
+
|**`st_size`**| Size of the file in bytes. |
72
71
73
-
If *fd* refers to a device, the **st_atime**, **st_ctime**, **st_mtime**, and **st_size** fields are not meaningful.
72
+
If *`fd`* refers to a device, the **`st_atime`**, **`st_ctime`**, **`st_mtime`**, and **`st_size`** fields aren't meaningful.
74
73
75
-
Because Stat.h uses the [_dev_t](../../c-runtime-library/standard-types.md) type, which is defined in Types.h, you must include Types.h before Stat.h in your code.
74
+
Because `Stat.h` uses the [`_dev_t`](../../c-runtime-library/standard-types.md) type, which is defined in `Types.h`, you must include `Types.h` before `Stat.h` in your code.
76
75
77
-
**_fstat64**, which uses the **__stat64** structure, allows file-creation dates to be expressed up through 23:59:59, December 31, 3000, UTC; whereas the other functions only represent dates through 23:59:59 January 18, 2038, UTC. Midnight, January 1, 1970, is the lower bound of the date range for all these functions.
76
+
**`_fstat64`**, which uses the **`__stat64`** structure, allows file-creation dates to be expressed up through 23:59:59, December 31, 3000, UTC; whereas the other functions only represent dates through 23:59:59 January 18, 2038, UTC. Midnight, January 1, 1970, is the lower bound of the date range for all these functions.
78
77
79
-
Variations of these functions support 32-bit or 64-bit time types and 32-bit or 64-bit file lengths. The first numerical suffix (**32** or **64**) indicates the size of the time type used; the second suffix is either **i32** or **i64**, indicating whether the file size is represented as a 32-bit or 64-bit integer.
78
+
Variations of these functions support 32-bit or 64-bit time types and 32-bit or 64-bit file lengths. The first numerical suffix (**32** or **64**) indicates the size of the time type used; the second suffix is either **`i32`** or **`i64`**, indicating whether the file size is represented as a 32-bit or 64-bit integer.
80
79
81
-
**_fstat** is equivalent to **_fstat64i32**, and **`struct`****_stat** contains a 64-bit time. This is true unless **_USE_32BIT_TIME_T** is defined, in which case the old behavior is in effect; **_fstat** uses a 32-bit time, and **`struct`****_stat** contains a 32-bit time. The same is true for **_fstati64**.
80
+
**`_fstat`** is equivalent to **`_fstat64i32`**, and **`struct`****`_stat`** contains a 64-bit time. This is true unless **`_USE_32BIT_TIME_T`** is defined, in which case the old behavior is in effect; **`_fstat`** uses a 32-bit time, and **`struct`****`_stat`** contains a 32-bit time. The same is true for **`_fstati64`**.
82
81
83
82
By default, this function's global state is scoped to the application. To change this, see [Global state in the CRT](../global-state.md).
84
83
85
-
### Time Type and File Length Type Variations of _stat
84
+
### Time Type and File Length Type Variations of `_stat`
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/mkgmtime-mkgmtime32-mkgmtime64.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ A quantity of type **`__time32_t`** or **`__time64_t`** representing the number
40
40
41
41
The **`_mkgmtime32`** and **`_mkgmtime64`** functions convert a UTC time to a **`__time32_t`** or **`__time64_t`** type representing the time in UTC. To convert a local time to UTC time, use **`mktime`**, **`_mktime32`**, and **`_mktime64`** instead.
42
42
43
-
**_mkgmtime** is an inline function that evaluates to **`_mkgmtime64`**, and **`time_t`** is equivalent to **`__time64_t`**. If you need to force the compiler to interpret **`time_t`** as the old 32-bit **`time_t`**, you can define **`_USE_32BIT_TIME_T`**. We don't recommend it, because your application might fail after January 18, 2038, the maximum range of a 32-bit **`time_t`**. It's not allowed at all on 64-bit platforms.
43
+
**`_mkgmtime`** is an inline function that evaluates to **`_mkgmtime64`**, and **`time_t`** is equivalent to **`__time64_t`**. If you need to force the compiler to interpret **`time_t`** as the old 32-bit **`time_t`**, you can define **`_USE_32BIT_TIME_T`**. We don't recommend it, because your application might fail after January 18, 2038, the maximum range of a 32-bit **`time_t`**. It's not allowed at all on 64-bit platforms.
44
44
45
45
The time structure passed in is changed as follows, in the same way as it's changed by the **`_mktime`** functions: the **`tm_wday`** and **`tm_yday`** fields are set to new values based on the values of **`tm_mday`** and **`tm_year`**. Because the time is assumed to be UTC, the **`tm_isdst`** field is ignored.
Copy file name to clipboardExpand all lines: docs/code-quality/c26813.md
+3-6Lines changed: 3 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,16 @@
1
1
---
2
2
description: "Learn more about: C26813"
3
3
title: c26813
4
-
keywords: c26813
5
-
ms.date: 02/23/2022
4
+
ms.date: 03/02/2022
6
5
ms.topic: reference
7
6
f1_keywords: ["C26813"]
8
7
helpviewer_keywords: ["C26813"]
9
-
dev_langs: ["C++"]
10
8
---
11
9
# C26813
12
10
13
11
> Warning C26813: Use 'bitwise and' to check if a flag is set
14
12
15
-
Most `enum`s with power of two member values are intended to be used with bit flags. As a result, we rarely want to equality compare these flags. We want to extract the bits we are interested in using bitwise operations instead.
13
+
Most `enum` types with power of two member values are intended to be used as bit flags. As a result, you rarely want to compare these flags for equality. Instead, extract the bits you're interested in by using bitwise operations.
16
14
17
15
## Example
18
16
@@ -41,8 +39,7 @@ void useEqualsWithBitwiseEnum(BitWise a)
Copy file name to clipboardExpand all lines: docs/code-quality/c26827.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,16 @@
1
1
---
2
2
description: "Learn more about: C26827"
3
3
title: c26827
4
-
keywords: c26814
5
-
ms.date: 02/23/2022
4
+
ms.date: 03/02/2022
6
5
ms.topic: reference
7
6
f1_keywords: ["C26827"]
8
7
helpviewer_keywords: ["C26827"]
9
-
dev_langs: ["C++"]
10
8
---
11
9
# C26827
12
10
13
-
> Warning C26827: Did you forgot to initialize an enum or wanted to use another type?
11
+
> Warning C26827: Did you forget to initialize an enum, or intend to use another type?
14
12
15
-
Most `enum` types used in bitwise operations are expected to have members with values of powers of two. This warning attempts to find cases where we forgot to give a value to an enum constant explicitly or inadvertently used the wrong enum type.
13
+
Most `enum` types used in bitwise operations are expected to have members with values of powers of two. This warning attempts to find cases where a value wasn't given explicitly to an enumeration constant. It also finds cases where the wrong enumeration type may have been used inadvertently.
16
14
17
15
## Example
18
16
@@ -27,11 +25,11 @@ enum class AlmostBitWise
27
25
28
26
intalmostBitwiseEnums(AlmostBitWise a, bool cond)
29
27
{
30
-
return (int)a|(int)AlmostBitWise::A; // Warning C26827: Did you forgot to initialize an enum or wanted to use another type?
28
+
return (int)a|(int)AlmostBitWise::A; // Warning C26827: Did you forget to initialize an enum, or intend to use another type?
31
29
}
32
30
```
33
31
34
-
To fix the warning, initialize the enum constant to the correct value or use the correct enum type in the operation.
32
+
To fix the warning, initialize the enumeration constant to the correct value, or use the correct enumeration type in the operation.
35
33
36
34
```cpp
37
35
enum class AlmostBitWise
@@ -50,5 +48,5 @@ int almostBitwiseEnums(AlmostBitWise a, bool cond)
Copy file name to clipboardExpand all lines: docs/code-quality/c26828.md
+4-7Lines changed: 4 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,16 @@
1
1
---
2
2
description: "Learn more about: C26828"
3
3
title: c26828
4
-
keywords: c26828
5
-
ms.date: 02/23/2022
4
+
ms.date: 03/02/2022
6
5
ms.topic: reference
7
6
f1_keywords: ["C26828"]
8
7
helpviewer_keywords: ["C26828"]
9
-
dev_langs: ["C++"]
10
8
---
11
9
# C26828
12
10
13
11
> Warning C26828: Different enum types have overlapping values. Did you want to use another enum constant here?
14
12
15
-
Most of the times we use a single enum to describe all the bit flags we can use for an option. If we use two different enum types in the same bitwise expression where the enums have overlapping values the chances are good those enums were not designed to be used in the expression.
13
+
Most of the time, a single enumeration type describes all the bit flags that you can use for an option. If you use two different enumeration types that have overlapping values in the same bitwise expression, the chances are good those enumeration types weren't designed for use together.
16
14
17
15
## Example
18
16
@@ -39,7 +37,7 @@ int overlappingBitwiseEnums(BitWiseA a)
39
37
}
40
38
```
41
39
42
-
To fix the warning make sure `enum`s that are designed to be used together have no overlapping values or make sure all the related options are in a single `enum`.
40
+
To fix the warning, make sure enumeration types designed for use together have no overlapping values. Or, make sure all the related options are in a single enumeration type.
43
41
44
42
```cpp
45
43
@@ -58,6 +56,5 @@ int overlappingBitwiseEnums(BitWiseA a)
0 commit comments