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
Copy file name to clipboardExpand all lines: docs/code-quality/c26471.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,3 +8,16 @@ helpviewer_keywords: ["C26471"]
8
8
# C26471 NO_REINTERPRET_CAST_FROM_VOID_PTR
9
9
10
10
Don't use `reinterpret_cast`. A cast from void* can use `static_cast`. See [C++ Core Guidelines Type.1](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-reinterpretcast).
11
+
12
+
## Example
13
+
```cpp
14
+
voidfunction(void* pValue)
15
+
{
16
+
{
17
+
int* pointerToInt = reinterpret_cast<int*>(pValue); // C26471, use static_cast instead
18
+
}
19
+
{
20
+
int* pointerToInt = static_cast<int*>(pValue); // Good
0 commit comments