[libcxx-commits] [PATCH] D120091: [libcxx] [test] Fix moneypunct grouping tests on Windows

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 21 11:07:08 PST 2022


Mordante accepted this revision as: Mordante.
Mordante added a comment.

LGTM!



================
Comment at: libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp:93
+#else
+    std::string us_grouping = "\3\3";
+#endif
----------------
mstorsjo wrote:
> Quuxplusone wrote:
> > https://en.cppreference.com/w/cpp/locale/numpunct/grouping
> > Geesh, this stuff is ridiculous. I buy how `\3` and `\3\3` are equivalent; but then my next question is, why does the existing code (on non-Windows) return `\3\3`? Is that due to something at the OS level that's out of our control, or is there some way that libc++ could fix it to sanely return a simple `\3` like cppreference says it should?
> Like most of these things, I guess it’s pretty much passthrough from the OS’s locale data. I guess we could fix it up within the library, but I’m not sure if it’s worth it, if they’re both functionally equivalent anyway.
Looking at my Linux system
en_US `mon_grouping        3;3`
fr_FR `mon_grouping              3`

So these values have this value in the system's locale.
I don't think libc++ should try to fix this, better to fix the system's locale instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120091/new/

https://reviews.llvm.org/D120091



More information about the libcxx-commits mailing list