Rendered at 11:33:38 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
arunc 2 minutes ago [-]
Articles with code examples that doesn't show their output are just silly. This one deals with `std::println` to print pointer formatting with no output.
randusername 3 minutes ago [-]
> This makes it possible to use static_assert for instance with std::format...
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.
veltas 4 hours ago [-]
Surely std::print() shouldn't print anything?
CamouflagedKiwi 3 hours ago [-]
It's a typo, he describes it as std::println in the text, but the code snippet is just print()
steeleduncan 3 hours ago [-]
I think it is a typo, and should be std::println()
nikbackm 3 hours ago [-]
Why even call it in that case?
xuhu 3 hours ago [-]
It's apparently a typo in the article, they probably meant to write `println()`.
IshKebab 2 hours ago [-]
Typo in this case, but in general supporting "useless" code like this is sometimes a good idea because it makes writing generic code easier. Maybe not in this case.
bluGill 2 minutes ago [-]
The counter is useless code often is a sign of a bug. Possibly someone started implementing something and then failed to finish it. I often want my compiler to warn on useless code.
Longhanks 3 hours ago [-]
> A related issue solved along was Windows string representation of paths. std::filesystem::path stores its text in wchar_t encoded as UTF-16 (Windows native). But p.string() narrows it down to the active code page, rather than UTF-8 which is what the formatting library expects. The result was a non-ASCII path could get transcoded to gibberish. The C++26 std::formatter<std::filesystem::path> converts Windows native UTC-16 to UTF-8 using Unicode transcoding and avoiding code pages, therefore solving the problem.
> Ill-formed UTF-16 is replaced with U+FFFD by default, or escaped under {:?}.
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.
...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