A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fmtlib/fmt/issues/4394 below:

Formatting long with FMT_BUILTIN_TYPES=0 · Issue #4394 · fmtlib/fmt · GitHub

Consider the following code sample using fmtlib v11.1.4 or master

#define FMT_BUILTIN_TYPES 0

#include <cstdint>
#include <fmt/format.h>

int main() {
    long n(1234);
    fmt::print("1234!={}", n);    
}

The expected output of this is 1234!=1234 however when built and run using FMT_BUILTIN_TYPES=0 the results are 1234!=536895556 (your results will vary)

Note that changing long to int will resolve this

I'm hitting this issue on non-eabi (defines int32_t as long) but I can also create on x64 MSVC.

My understand is of this is that during argument processing custom.value and custom.format are set, but then basic_format_args::type detects as detail::type::int_type so then during formatting (visit) the wrong member of the union is used.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4