<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/101397>101397</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[docs][clang-tidy] modernize-use-std-print document for StrictMode seems incorrect
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
another-pjohnson
</td>
</tr>
</table>
<pre>
```
StrictMode[ΒΆ](https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-std-print.html#cmdoption-arg-StrictMode)
When true, the check will add casts when converting from variadic functions like printf and printing signed or unsigned integer types (including fixed-width integer types from <cstdint>, ptrdiff_t, size_t and ssize_t) as the opposite signedness to ensure that the output matches that of printf. This does not apply when converting from non-variadic functions such as absl::PrintF and fmt::printf. For example, with StrictMode enabled:
int i = -42;
unsigned int u = 0xffffffff;
printf("%d %u\n", i, u);
would be converted to:
std::print("{} {}\n", static_cast<unsigned int>(i), static_cast<int>(u));
to ensure that the output will continue to be the unsigned representation of -42 and the signed representation of 0xffffffff (often 4294967254 and -1 respectively.) When false (which is the default), these casts will not be added which may cause a change in the output.
```
This logic doesn't make sense, I think the example was supposed to swap the order of i and u.
See the compiler explorer with this exact example:
https://godbolt.org/z/czxjW3s6b
Results are
```
-42 4294967295 (printf)
4294967254 -1 (std::print)
```
In StrictMode, i would expect you want to maintain the exact same value printed out unless I am missing something.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VUuP2zYQ_jX0ZSDDpqT16uBD1lsDORQomgI5BhQ5spilSIEc-rG_viAlO8o2qWHoxXl_38yIEPTJIu5Z_cLq15WI1Du_F9ZRj74Yv7veBmdXrVO3PXvazP_NK9t8-kJeS_rTKUzKB85enlj9yvhzTzQGVn5i_Mj4URphT2tjzsPa-RPjR7ySF_eDgrS6pZce5Vtg_Dg4hd7qd2T8GAMWgVQxem1p3dNgGC_loNxI2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