Locale constructor locale(const char* std_name) may create locale with broken facets.
When std_name looks like "CAT1=name1;...;CATN=nameN", categories for which name is "C" may have members, which differ from ones in "C" locale. e.g. decimal_point() in moneypunct<> facet returns '\0' while in "C" locale it returns '.'. Also thousands_sep() in numpunct<> returns '\0' while in "C" locale it returns ','. Example: [test.cpp] #include <locale> #include <iostream> using namespace std; int main() { locale loc(locale("C"), "en_US", locale::collate); cout << "Name of locale is " << loc.name() << endl; locale loc_copy(loc.name().c_str()); if(use_facet<moneypunct<char> >(loc_copy).decimal_point() == '\0') cout << "decimal_point() is '\\0'\n"; return 0; } [EMAIL PROTECTED] locale_create_from_name]$ g++ test.cpp && ./a.out Name of locale is LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=en_US;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C decimal_point() is '\0' [EMAIL PROTECTED] locale_create_from_name]$ g++ --version g++ (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8) Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- Summary: locale(const char* std_name) may create locale with broken facets Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tsyvarev at ispras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38368