This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/16673] The user defined locale could get from locale("").
- From: "bzhang at platform dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jul 2004 18:42:24 -0000
- Subject: [Bug libstdc++/16673] The user defined locale could get from locale("").
- References: <20040722160401.16673.bzhang@platform.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bzhang at platform dot com 2004-07-22 18:42 -------
The version with problem is version 3.2
109:bzhang@qa7 ~/working/workshop> gcc -v
Reading specs from /opt/redhat/comp-tools-3.2/lib/gcc-lib/i386-redhat-linux/3.2/
specs
Configured with: ../configure --prefix=/opt/redhat/comp-tools-3.2 --mandir=/opt/
redhat/comp-tools-3.2/share/man --infodir=/opt/redhat/comp-tools-3.2/share/info
--enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-lin
ux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-8)
110:bzhang@qa7 ~/working/workshop> more mylocale.cpp
#include <stdio.h>
#include <iostream>
#include <locale>
int
main(int argc, char **argv)
{
using namespace std;
char *temp;
locale loc1("");
if (temp = getenv("LANG")) {
cout << "The value of env LANG: " << temp << "\n";
}
cout << "name of user preferred locale: " << locale("").name() << "\n";
}
111:bzhang@qa7 ~/working/workshop> g++ mylocale.cpp
112:bzhang@qa7 ~/working/workshop> a.out
The value of env LANG: fr_CA
name of user preferred locale: C
113:bzhang@qa7 ~/working/workshop> echo $LANG
fr_CA
When I tested the very same one on 3.2.2, it works.
33:bzhang@qatest02 ~/working/workshop> gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/u
sr/share/info --enable-shared --enable-threads=posix --disable-checking --with-s
ystem-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
34:bzhang@qatest02 ~/working/workshop> g++ mylocale.cpp
35:bzhang@qatest02 ~/working/workshop> setenv LANG fr_CA
36:bzhang@qatest02 ~/working/workshop> a.out
The value of env LANG: fr_CA
name of user preferred locale: fr_CA
Cheers,
Bohai
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16673