[libcxx-commits] [libcxx] [libc++] Use std::to_chars to format thread::id and canonicalize the representation across platforms (PR #181624)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 9 03:35:54 PDT 2026
================
----------------
philnik777 wrote:
> This explains why [@mordante](https://github.com/mordante) originally implemented it that way. You mention the output may change: can you describe it changes from what to what?
On platforms where `__thread_id` is a pointer type it was previously printed as a hexadecimal number - just like a pointer, but is now printed in decimal format. Other platforms use integers, which have been printed in decimal format before and still are being printed the same.
> Can you also confirm that there is nothing normative requiring `thread::id`'s `std::format` result to match the stream output operators? If that's the case, then I guess it just means that [@mordante](https://github.com/mordante) wanted to provide that guarantee as a QOI matter but it's not required by the Standard, and we can consider this change. If there's normative wording to that effect, well, we can't make this change.
I can't, but as you noticed yourself below, I change both outputs in sync to keep the same formatting.
https://github.com/llvm/llvm-project/pull/181624
More information about the libcxx-commits
mailing list