This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Fix libstdc++/7811
- From: Roland McGrath <roland at redhat dot com>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 5 Sep 2002 11:18:02 -0700
- Subject: Re: [PATCH] Fix libstdc++/7811
- References: <3D779E21.7020809@unitus.it>
> I'm unsure about the following points: in case LC_ALL is not set is the
> fallback to LANG really needed (PR submitter implicitly expected this
> to be the case)? Also, if neither are set is always correct that "" -> "C"?
The standards specify looking at LC_ALL, then at the variable for the
particular category if setting just one, then at LANG. Note that a variable
that is present but empty (e.g. getenv("LC_ALL") => "") is treated as not
present. Off hand I am not sure if the behavior when none are set is
specified or is implementation-defined. Defaulting to "C" is safe and
consistent.
Another thing to note if you want to match the selection behavior of
setlocale is that if the name contains a slash and the program is setuid
then the name will be ignored and "C" used instead. (It doesn't check
this on each variable, just on the name chosen from any.)