Re: g++ Locale ?? correction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2017/5/3 15:09, Xi Ruoyao wrote:
On 2017-05-03 14:32 +0800, Liu Hao wrote:
On 2017/5/3 14:12, Xi Ruoyao wrote:
Liu Hao (CCed him) once said his (maybe modified) libstdc++
also support locale name "" (empty string).  Maybe he can help
you.
No I didn't modify GCC or libstdc++ source. The "" (empty string) locale
works fine and conforms to the standard on my computer (that is, it is
identical to the "C" locale).

So where did you get the code?  Libstdc++ in current GCC trunk throw
exception for all locales (even if "") except "C".

I'll look at the standard.  Maybe upstream libstdc++ need a fix for
"" locale.


```plaintext
E:\Desktop>g++ --version
g++ (gcc-7-branch HEAD with MCF thread model, built by LH_Mouse.) 7.1.1 20170503
Copyright (C) 2017 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.


E:\Desktop>cat test.cc
#include <locale>
#include <iostream>

int main()
{
  std::locale::global(std::locale(""));

  std::locale current_locale;
  std::cout << "Locale is now: " << current_locale.name() << std::endl;
  return 0;
}

E:\Desktop>g++ test.cc -std=c++11 -Wall -Wextra -pedantic

E:\Desktop>a.exe
Locale is now: C
```

No errors. No exceptions.

--
Best regards,
LH_Mouse




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux