Skip to content

Latest commit

 

History

History
3522 lines (2784 loc) · 127 KB

File metadata and controls

3522 lines (2784 loc) · 127 KB

12.2.0 - 2026-06-16

  • Added a C11 API that brings fast, type-safe formatting to C. The new fmt-c library and fmt/fmt-c.h header use _Generic to dispatch on argument types and outperform printf/sprintf. For example:

    #include <fmt/fmt-c.h>
    
    fmt_print(stdout, "The answer is {}.\n", 42);

    (fmtlib/fmt#4663, fmtlib/fmt#4671, fmtlib/fmt#4696, fmtlib/fmt#4693, fmtlib/fmt#4694, fmtlib/fmt#4712, fmtlib/fmt#4789). Thanks @Soumik15630m, @Ferdi265 and @localspook.

  • Added a separate fmt::fmt-module CMake target for C++20 modules and a CI workflow that exercises module-based builds (fmtlib/fmt#4684, fmtlib/fmt#4685, fmtlib/fmt#4707, fmtlib/fmt#4708, fmtlib/fmt#4702, fmtlib/fmt#4709). Thanks @MathewBensonCode.

  • Enabled the full Dragonbox lookup cache by default for floating-point formatting unless optimizing for binary size (__OPTIMIZE_SIZE__), giving a ~10–25% speedup. Thanks Matthias Kretz for the suggestion. Average time per double on Apple M1 Pro (clang 17, random digits, smaller is better) measured with dtoa-benchmark:

    Method Time (ns)
    fmt (full) 22.07
    fmt (compact) 29.55
    ryu 35.21
    double-conversion 81.81
    sprintf 726.27
    ostringstream 864.34
  • Improved integer formatting performance by ~3% (fmtlib/fmt#4630). Thanks @user202729.

  • Optimized formatting into back-insert iterators by using bulk container append/insert methods (e.g. on std::vector<char> and custom string types) (fmtlib/fmt#4679). Thanks @user202729.

  • Reduced binary size of debug builds (~200k to ~85k in the bloat test) and improved compile speed when consteval is unavailable.

  • Made path formatting lossless, preserving ill-formed UTF-16 sequences when converting std::filesystem::path to a narrow string.

  • Added support for formatting std::unexpected (fmtlib/fmt#4675). Thanks @17steen.

  • Added overloads of fmt::println that take a fmt::text_style (fmtlib/fmt#4782). Thanks @ahoarau.

  • Added support for positional arguments as width and precision specifiers in fmt::printf (fmtlib/fmt#4643). Thanks @KareemOtoum.

  • Made FMT_STRING a no-op when FMT_USE_CONSTEVAL is enabled, since the consteval format-string constructor already provides compile-time validation (fmtlib/fmt#4611, fmtlib/fmt#4612). Thanks @friedkeenan.

  • Promoted fmt::detail::named_arg to the public API as fmt::named_arg and deprecated the detail alias (fmtlib/fmt#4683, fmtlib/fmt#4687). Thanks @TPPPP72.

  • Moved the std::byte formatter from fmt/format.h to fmt/std.h.

  • Provided a default definition for fmt::is_contiguous (fmtlib/fmt#4731, fmtlib/fmt#4770). Thanks @user202729 and @phprus.

  • Added the FMT_USE_FLOCKFILE macro to disable the use of flockfile (fmtlib/fmt#4646, fmtlib/fmt#4666). Thanks @mvastola.

  • Added include_guard(GLOBAL) so that {fmt} can be used in multiple submodules of the same project (fmtlib/fmt#4672). Thanks @torsten48.

  • Improved constexpr support (fmtlib/fmt#4659, fmtlib/fmt#4591). Thanks @elbeno and @17steen.

  • Deprecated the implicit conversion from fmt::format_string and fmt::basic_fstring to string_view to align with std::format_string; use format_string::get() instead.

  • Opted out std::complex from tuple formatting so that the dedicated std::complex formatter is always used.

  • Removed the fmt::say function.

  • Deprecated the std::initializer_list overload of fmt::join and the array overload of fmt::vformat_to.

  • Made the <fmt/core.h> header equivalent to <fmt/base.h> by default. Code that relied on <fmt/core.h> pulling in <fmt/format.h> must now either include <fmt/format.h> directly or define FMT_DEPRECATED_HEAVY_CORE to opt back in.

  • Improved wchar_t support: fmt::join now accepts wchar_t and other non-char separators, and fmt::format_to_n now works with fmt::runtime on wchar_t (fmtlib/fmt#4686, fmtlib/fmt#4714, fmtlib/fmt#4715). Thanks @Yancey2023 and @sunmy2019.

  • Fixed formatting of std::tm with a null tm_zone (fmtlib/fmt#4790). Thanks @Carmel0.

  • Fixed compile-time formatting in fmt/ranges.h, fmt/style.h and fmt/std.h (fmtlib/fmt#4759). Thanks @j4niwzis.

  • Fixed an ambiguity between formatter<std::optional<T>> in fmt/std.h and fmt/ranges.h on C++26 (P3168R2) (fmtlib/fmt#4761). Thanks @phprus.

  • Fixed a GCC PCH breakage triggered by a scoped #pragma GCC optimize.

  • Fixed a TSAN false positive in the locale handling code (fmtlib/fmt#4755).

  • Fixed compile-time format string checks truncating string literals at an embedded null byte (fmtlib/fmt#4732). Thanks @user202729.

  • Fixed out-of-bounds reads in printf formatting (fmtlib/fmt#4741, fmtlib/fmt#4742, fmtlib/fmt#4800). Thanks @Algunenano and @aizu-m.

  • Fixed the return type of the f(un)lockfile wrappers on Windows (fmtlib/fmt#4739). Thanks @mvastola.

  • Worked around a CUDA issue when handling UTF-32 literals (fmtlib/fmt#4719). Thanks @Cazadorro.

  • Fixed missing named-argument validation for compiled format strings (fmtlib/fmt#4638). Thanks @JaeheonShim.

  • Fixed fmt::format_to_n in <fmt/compile.h> failing to compile when <iterator> is not transitively included (fmtlib/fmt#4615).

  • Fixed handling of pointers in format string compilation with FMT_BUILTIN_TYPES=0.

  • Stopped assuming nul termination of the format string in fmt::printf. Thanks @ZUENS2020 for reporting.

  • Fixed a build error when locale support is disabled (fmtlib/fmt#4627). Thanks @marcel-behlau-elfin.

  • Fixed a fallback range formatter for types with a container_type member (fmtlib/fmt#4123, fmtlib/fmt#4660). Thanks @Soumik15630m.

  • Fixed C++20 concept detection (fmtlib/fmt#4653). Thanks @tearfur.

  • Fixed a clang compilation failure (fmtlib/fmt#4718). Thanks @mccakit.

  • Fixed various MSVC warnings, including C4305 and conversion warnings on x86 (fmtlib/fmt#4668, fmtlib/fmt#4594). Thanks @kanren3 and @blizzard4591.

  • Updated the Android Gradle Plugin to 9.x (fmtlib/fmt#4651, fmtlib/fmt#4658). Thanks @Soumik15630m.

  • Made various code, build and test improvements (fmtlib/fmt#4625, fmtlib/fmt#4639, fmtlib/fmt#4644, fmtlib/fmt#4656, fmtlib/fmt#4680, fmtlib/fmt#4681, fmtlib/fmt#4704, fmtlib/fmt#4710, fmtlib/fmt#4713, fmtlib/fmt#4729, fmtlib/fmt#4751, fmtlib/fmt#4758, fmtlib/fmt#4799). Thanks @ZephyrLykos, @togunchan, @kagancansit, @BerndPetrovitsch, @Skylion007, @st0rmbtw, @localspook and @EXtremeExploit.

  • Improved documentation, including a rewrite of the format string syntax, better handling of doxygen tags, documenting output_file, fixing CSS so that whitespace is displayed properly, and various smaller fixes (fmtlib/fmt#4622, fmtlib/fmt#4626, fmtlib/fmt#4631, fmtlib/fmt#4667, fmtlib/fmt#4616, fmtlib/fmt#4748). Thanks @heavywatal, @ZephyrLykos, @user202729, @ssszcmawo, @bigmoonbit and @Powerbyte7.

  • Added building of release artifacts and SLSA provenance in CI, added a CodeQL workflow, and added the security policy in .github/SECURITY.md.

12.1.0 - 2025-10-29

12.0.0 - 2025-09-17

  • Optimized the default floating point formatting (fmtlib/fmt#3675, fmtlib/fmt#4516). In particular, formatting a double with format string compilation into a stack allocated buffer is more than 60% faster in version 12.0 compared to 11.2 according to dtoa-benchmark:

    Function  Time (ns)  Speedup
    fmt11        34.471    1.00x
    fmt12        21.000    1.64x
    
  • Added constexpr support to fmt::format. For example:

    #include <fmt/compile.h>
    
    using namespace fmt::literals;
    std::string s = fmt::format(""_cf, 42);

    now works at compile time provided that std::string supports constexpr (fmtlib/fmt#3403, fmtlib/fmt#4456). Thanks @msvetkin.

  • Added FMT_STATIC_FORMAT that allows formatting into a string of the exact required size at compile time.

    For example:

    #include <fmt/compile.h>
    
    constexpr auto s = FMT_STATIC_FORMAT("{}", 42);

    compiles to just

    __ZL1s:
          .asciiz "42"

    It can be accessed as a C string with s.c_str() or as a string view with s.str().

  • Improved C++20 module support (fmtlib/fmt#4451, fmtlib/fmt#4459, fmtlib/fmt#4476, fmtlib/fmt#4488, fmtlib/fmt#4491, fmtlib/fmt#4495). Thanks @arBmind, @tkhyn, @Mishura4, @anonymouspc and @autoantwort.

  • Switched to using estimated display width in precision. For example:

    fmt::print("|{:.4}|\n|1234|\n", "🐱🐱🐱");

    prints

    because 🐱 has an estimated width of 2 (fmtlib/fmt#4272, fmtlib/fmt#4443, fmtlib/fmt#4475). Thanks @nikhilreddydev and @localspook.

  • Fix interaction between debug presentation, precision, and width for strings (fmtlib/fmt#4478). Thanks @localspook.

  • Implemented allocator propagation on basic_memory_buffer move (fmtlib/fmt#4487, fmtlib/fmt#4490). Thanks @toprakmurat.

  • Fixed an ambiguity between std::reference_wrapper<T> and format_as formatters (fmtlib/fmt#4424, fmtlib/fmt#4434). Thanks @jeremy-rifkin.

  • Removed the following deprecated APIs:

    • has_formatter: use is_formattable instead,
    • basic_format_args::parse_context_type, basic_format_args::formatter_type and similar aliases in context types,
    • wide stream overload of fmt::printf,
    • wide stream overloads of fmt::print that take text styles,
    • is_*char traits,
    • fmt::localtime.
  • Deprecated wide overloads of fmt::fprintf and fmt::sprintf.

  • Improved diagnostics for the incorrect usage of fmt::ptr (fmtlib/fmt#4453). Thanks @TobiSchluter.

  • Made handling of ANSI escape sequences more efficient (fmtlib/fmt#4511, fmtlib/fmt#4528). Thanks @localspook and @Anas-Hamdane.

  • Fixed a buffer overflow on all emphasis flags set (fmtlib/fmt#4498). Thanks @dominicpoeschko.

  • Fixed an integer overflow for precision close to the max int value.

  • Fixed compatibility with WASI (fmtlib/fmt#4496, fmtlib/fmt#4497). Thanks @whitequark.

  • Fixed back_insert_iterator detection, preventing a fallback on slower path that handles arbitrary iterators (fmtlib/fmt#4454).

  • Fixed handling of invalid glibc FILE buffers (fmtlib/fmt#4469).

  • Added wchar_t support to the std::byte formatter (fmtlib/fmt#4479, fmtlib/fmt#4480). Thanks @phprus.

  • Changed component prefix from fmt- to fmt_ for compatibility with NSIS/CPack on Windows, e.g. fmt-doc changed to fmt_doc (fmtlib/fmt#4441, fmtlib/fmt#4442). Thanks @n-stein.

  • Added the FMT_CUSTOM_ASSERT_FAIL macro to simplify providing a custom fmt::assert_fail implementation (fmtlib/fmt#4505). Thanks @HazardyKnusperkeks.

  • Switched to FMT_THROW on reporting format errors so that it can be overriden by users when exceptions are disabled (fmtlib/fmt#4521). Thanks @HazardyKnusperkeks.

  • Improved master project detection and disabled install targets when using {fmt} as a subproject by default (fmtlib/fmt#4536). Thanks @crueter.

  • Made various code improvements (fmtlib/fmt#4445, fmtlib/fmt#4448, fmtlib/fmt#4473, fmtlib/fmt#4522). Thanks @localspook, @tchaikov and @way4sahil.

  • Added Conan instructions to the docs (fmtlib/fmt#4537). Thanks @uilianries.

  • Removed Bazel files to avoid issues with downstream packaging (fmtlib/fmt#4530). Thanks @mering.

  • Added more entries for generated files to .gitignore (fmtlib/fmt#4355, fmtlib/fmt#4512). Thanks @dinomight and @localspook.

  • Fixed various warnings and compilation issues (fmtlib/fmt#4447, fmtlib/fmt#4470, fmtlib/fmt#4474, fmtlib/fmt#4477, fmtlib/fmt#4471, fmtlib/fmt#4483, fmtlib/fmt#4515, fmtlib/fmt#4533, fmtlib/fmt#4534). Thanks @dodomorandi, @localspook, @remyjette, @Tomek-Stolarczyk, @Mishura4, @mattiasljungstrom and @FatihBAKIR.

11.2.0 - 2025-05-03

  • Added the s specifier for std::error_code. It allows formatting an error message as a string. For example:

    #include <fmt/std.h>
    
    int main() {
      auto ec = std::make_error_code(std::errc::no_such_file_or_directory);
      fmt::print("{:s}\n", ec);
    }

    prints

    No such file or directory
    

    (The actual message is platform-specific.)

  • Fixed formatting of std::chrono::local_time and tm (fmtlib/fmt#3815, fmtlib/fmt#4350). For example (godbolt):

    #include <fmt/chrono.h>
    
    int main() {
      std::chrono::zoned_time zt(
        std::chrono::current_zone(),
        std::chrono::system_clock::now());
      fmt::print("{}", zt.get_local_time());
    }

    is now formatted consistenly across platforms.

  • Added diagnostics for cases when timezone information is not available. For example:

    fmt::print("{:Z}", std::chrono::local_seconds());

    now gives a compile-time error.

  • Deprecated fmt::localtime in favor of std::localtime.

  • Fixed compilation with GCC 15 and C++20 modules enabled (fmtlib/fmt#4347). Thanks @tkhyn.

  • Fixed handling of named arguments in format specs (fmtlib/fmt#4360, fmtlib/fmt#4361). Thanks @dinomight.

  • Added error reporting for duplicate named arguments (fmtlib/fmt#4282, fmtlib/fmt#4367). Thanks @dinomight.

  • Fixed formatting of long with FMT_BUILTIN_TYPES=0 (fmtlib/fmt#4375, fmtlib/fmt#4394).

  • Optimized text_style using bit packing (fmtlib/fmt#4363). Thanks @localspook.

  • Added support for incomplete types (fmtlib/fmt#3180, fmtlib/fmt#4383). Thanks @localspook.

  • Fixed a flush issue in fmt::print when using libstdc++ (fmtlib/fmt#4398).

  • Fixed fmt::println usage with FMT_ENFORCE_COMPILE_STRING and legacy compile-time checks (fmtlib/fmt#4407). Thanks @madmaxoft.

  • Removed legacy header fmt/core.h from docs (fmtlib/fmt#4421, fmtlib/fmt#4422). Thanks @krzysztofkortas.

  • Worked around limitations of __builtin_strlen during constant evaluation (fmtlib/fmt#4423, fmtlib/fmt#4429). Thanks @BRevzin.

  • Worked around a bug in MSVC v141 (fmtlib/fmt#4412, fmtlib/fmt#4413). Thanks @hirohira9119.

  • Removed the fmt_detail namespace (fmtlib/fmt#4324).

  • Removed specializations of std::is_floating_point in tests (fmtlib/fmt#4417).

  • Fixed a CMake error when setting CMAKE_MODULE_PATH in the pedantic mode (fmtlib/fmt#4426). Thanks @rlalik.

  • Updated the Bazel config (fmtlib/fmt#4400). Thanks @Vertexwahn.

11.1.4 - 2025-02-26

11.1.3 - 2025-01-25

11.1.2 - 2025-01-12

11.1.1 - 2024-12-27

  • Fixed ABI compatibility with earlier 11.x versions (fmtlib/fmt#4278).

  • Defined CMake components (core and doc) to allow docs to be installed separately (fmtlib/fmt#4276). Thanks @carlsmedstad.

11.1.0 - 2024-12-25

11.0.2 - 2024-07-20

11.0.1 - 2024-07-05

11.0.0 - 2024-07-01

10.2.1 - 2024-01-04

10.2.0 - 2024-01-01

10.1.1 - 2023-08-28

10.1.0 - 2023-08-12

10.0.0 - 2023-05-09

9.1.0 - 2022-08-27

9.0.0 - 2022-07-04

8.1.1 - 2022-01-06

8.1.0 - 2022-01-02

8.0.1 - 2021-07-02

8.0.0 - 2021-06-21

The change log for versions 0.8.0 - 7.1.3 is available here.