mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 09:28:21 +00:00
Add a comment to clarify why convert to unsigned
This commit is contained in:
parent
bb7a80b1ab
commit
ae6368c985
@ -328,6 +328,9 @@ class ArgConverter : public fmt::internal::ArgVisitor<ArgConverter<T>, void> {
|
||||
} else {
|
||||
if (is_signed) {
|
||||
arg_.type = Arg::LONG_LONG;
|
||||
// Convert value to unsigned type before converting to long long for
|
||||
// consistency with glibc's printf even though in general it's UB:
|
||||
// std::printf("%lld", -42); // prints "4294967254"
|
||||
arg_.long_long_value =
|
||||
static_cast<typename fmt::internal::MakeUnsigned<U>::Type>(value);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user