Skip to content

Commit c4f3821

Browse files
committed
Address review comments.
1 parent cca9409 commit c4f3821

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/code-quality/c6392.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,54 @@ helpviewer_keywords: ["C6392"]
77
---
88
# Warning C6392
99

10-
> This expression will write the value of the pointer to the stream; if this is intentional, add an explicit cast to 'void *'
10+
> This expression writes the value of the pointer to the stream. If this is intentional, add an explicit cast to 'void *'
1111
1212
This rule was added in Visual Studio 2022 17.8.
1313

1414
## Remarks
1515

16-
In C++, we have streams of wide characters, like `std::wostringstream`, and streams of nonwide characters like `std::ostringstream`. Trying to print a wide character literal to a nonwide string calls the `void*` overload of `operator<<`. This overload prints the address of the wide string literal instead of the value.
16+
C++ supports wide character streams such as `std::wostringstream`, and nonwide character streams such as `std::ostringstream`. Trying to print a wide string literal to a nonwide stream calls the `void*` overload of `operator<<`. This overload prints the address of the wide string literal instead of the value.
1717

1818
Code analysis name: `STREAM_OUTPUT_VOID_PTR`
1919

2020
## Example
2121

22-
In the following code snippet, we print the value of the pointer to the standard output instead of the string `"Foo"`:
22+
The following code snippet prints the value of the pointer to the standard output instead of the string `"Pear"`:
2323

2424
```cpp
2525
#include <iostream>
2626

2727
int main() {
28-
std::cout << L"Foo\n"; // Warning: C6392
28+
std::cout << L"Pear\n"; // Warning: C6392
2929
}
3030
```
3131

32-
There are multiple ways to fix this error. If printing the pointer value is unintended, we can use a nonwide string literal:
32+
There are multiple ways to fix this error. If printing the pointer value is unintended, one can use a nonwide string literal:
3333

3434
```cpp
3535
#include <iostream>
3636

3737
int main() {
38-
std::cout << "Foo\n"; // No warning.
38+
std::cout << "Pear\n"; // No warning.
3939
}
4040
```
4141

42-
Alternatively, we can use a wide stream:
42+
Alternatively, one can use a wide stream:
4343

4444
```cpp
4545
#include <iostream>
4646

4747
int main() {
48-
std::wcout << L"Foo\n"; // No warning.
48+
std::wcout << L"Pear\n"; // No warning.
4949
}
5050
```
5151

52-
If the behavior is intentional, we can silence the warning using an explicit cast:
52+
If the behavior is intentional, silence the warning by using an explicit cast:
5353

5454
```cpp
5555
#include <iostream>
5656

5757
int main() {
58-
std::cout << static_cast<void*>(L"Foo\n"); // No warning.
58+
std::cout << static_cast<void*>(L"Pear\n"); // No warning.
5959
}
6060
```

0 commit comments

Comments
 (0)