Re: g++ Locale ?? correction

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

 



On 3 May 2017 at 15:00, Papa wrote:
> Thanks for the comments, however, as long as gcc does not provide a solid
> support for std::locale, I would say it is better to use
> std::setlocale(...). So, in that regard, I'd like to provide another piece
> of information that I consider extremely interesting, since it appears to be
> a bug and not a human error, please look at the following code
>
> <snip>
> //This code works ??
> void jme::Locale::setGlobalLocale(const std::string& str){
>      std::string tmp;
>      tmp = std::setlocale(LC_ALL, "");
> }
> </snip>
>
> <snip>
> //This does not code works ??
> void jme::Locale::setGlobalLocale(const std::string& str){
>      std::string tmp;
>      tmp = std::setlocale(LC_ALL, str.data() );
> }
> </snip>
>
> This shows that either std::setlocale(...)  does not know how to handle
> std::string::data()/std::string::c_str()  return value or neither
> std::string::data() nor std::string::c_str() return the expected value

Not necessarily. Assuming the content of str is "", it suggests a
problem with the MinGW setlocale function, maybe it can't handle const
char* values that are not allocated in static storage.



[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