This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] libstdc++/7811
> It's not just a good idea, it's the law. The C++ Standard requires
> std::locale::name() and std::setlocale() to use the same format for
> composite locales. This is a nontrivial requirement.
I don't know what the C++ says about extra locale categories,
but the sensible thing to do is to include all the categories setlocale
understands in the composite name even if C++ doesn't do anything with
them. Otherwise, you could lose some settings going from a user's
LANG environment variable -> C++ -> environment -> C setlocale.
That case can be handled right by just preserving the user's setting.
But if it's actually multiple LC_* vars -> C++ -> just LANG -> C,
then you would want to make sure that the C++ code collecting environment
variables collects all the ones that setlocale would.