[clang-tools-extra] [clang-tidy]add new check bugprone-unintended-char-ostream-output (PR #127720)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 02:48:13 PST 2025


================
@@ -0,0 +1,30 @@
+.. title:: clang-tidy - bugprone-unintended-char-ostream-output
+
+bugprone-unintended-char-ostream-output
+=======================================
+
+Finds unintended character output from ``unsigned char`` and ``signed char`` to an
+``ostream``.
+
+Normally, when ``unsigned char (uint8_t)`` or ``signed char (int8_t)`` is used, it
+is more likely a number than a character. However, when it is passed directly to
+``std::ostream``'s ``operator<<``, resulting in character-based output instead
+of numeric value. This often contradicts the developer's intent to print
----------------
whisperity wrote:

```suggestion
is more likely a number than a character. However, when it is passed directly to
``std::ostream``'s ``operator<<``, the result is the character output instead
of the numeric value. This often contradicts the developer's intent to print
```

https://github.com/llvm/llvm-project/pull/127720


More information about the cfe-commits mailing list