llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tidy

Author: Mainak Sil (MainakSil)

<details>
<summary>Changes</summary>

Updated the example in the `StrictMode` section of the clang-tidy check 
`modernize-use-std-print`.

The previous example incorrectly swapped the cast of signed and unsigned 
integers. Specifically:
- The signed integer `i` was being cast to `unsigned int`, and
- The unsigned integer `u` was being cast to `int`.

This correction ensures that the behavior of `std::print` with `StrictMode` 
enabled matches that of `printf`, by reversing the casts to maintain the 
correct signedness. 

Issue Refference
It solves #<!-- -->101397

---
Full diff: https://github.com/llvm/llvm-project/pull/108805.diff


1 Files Affected:

- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst (+1-1) 


``````````diff
diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst 
b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
index 59bb722e2c24fc..a825cd7432a57d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
@@ -109,7 +109,7 @@ Options
 
   .. code-block:: c++
 
-    std::print("{} {}\n", static_cast<unsigned int>(i), static_cast<int>(u));
+    std::print("{} {}\n", static_cast<int>(u), static_cast<unsigned int>(i));
 
   to ensure that the output will continue to be the unsigned representation
   of `-42` and the signed representation of `0xffffffff` (often

``````````

</details>


https://github.com/llvm/llvm-project/pull/108805
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to