37 points · by jandeboevrie · 5mo ago · 19 comments
This past year we were porting Elemental (PC game) to 64-bit so it's pretty old code. There are a gazillion different string types in it (sprintf and beyond).
...only to then convert it back to UTF-16 for WriteConsoleW(), which std::print() usually calls (unless not running in a console) (https://github.com/microsoft/STL/blob/488e7953685722d2d6666f...).
Silently corrupting the path seems an odd choice in this day and age, when WTF8 has existed for many years and fixes this round trip bug / security vulnerability
This is great but it sounds like it doesn't work for floats yet
> For now, compile-time std::format covers integers, strings, and diagnostics well, with floating-point support waiting on a separate paper (P3652) to make the floating-point <charconv> functions constexpr.
To the best of my knowledge fmtlib does implement constexpr formatting for float and double, but not long double.