This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix wide charater literals (was Re: [RFC] Unexpected compiler twist of the wcscoll issue)
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 12 Mar 2002 09:34:32 -0800 (PST)
- Subject: Re: [PATCH] Fix wide charater literals (was Re: [RFC] Unexpected compiler twist of the wcscoll issue)
> Nope, setlocale matters for program's runtime, but if gcc is configured
> with --enable-c-mbchar, then what matters is LANG of the cc1 process
> (ie. what sets literal_codeset variable).
see
// libstdc++/5280
void test03()
{
#ifdef _GLIBCPP_HAVE_SETENV
// Set the global locale to non-"C".
std::locale loc_de("de_DE");
std::locale::global(loc_de);
// Set LANG environment variable to de_DE.
const char* oldLANG = getenv("LANG");
if (!setenv("LANG", "de_DE", 1))
{
test01();
test02();
setenv("LANG", oldLANG ? oldLANG : "", 1);
}
#endif
}