Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #9016 > unrolled thread

std::locale problem on Mac OSX

Started bymeskio <meskio@gmail.com>
First post2011-08-17 15:07 -0700
Last post2011-08-20 12:35 +0200
Articles 4 — 4 participants

Back to article view | Back to comp.lang.c++


Contents

  std::locale problem on Mac OSX meskio <meskio@gmail.com> - 2011-08-17 15:07 -0700
    Re: std::locale problem on Mac OSX "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-18 03:23 +0200
      Re: std::locale problem on Mac OSX Nobody <nobody@nowhere.com> - 2011-08-18 18:44 +0100
    Re: std::locale problem on Mac OSX Vaclav Zeman <vzeman79@sh.cvut.cz> - 2011-08-20 12:35 +0200

#9016 — std::locale problem on Mac OSX

Frommeskio <meskio@gmail.com>
Date2011-08-17 15:07 -0700
Subjectstd::locale problem on Mac OSX
Message-ID<90f58b01-b19c-4c50-90e0-af3a84822fb0@h14g2000yqd.googlegroups.com>
I get a runtime_error while porting a program to Mac OSX 10.6 with
std::locale.

#include <locale>
int main ( int argc, char *argv [] ) {
    std::locale mylocale("");
    return 0;
}

Returns an error for any locale diferent than "C":
bash-3.2$ LANG=es_ES.UTF-8 ./locale
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Abort trap


Is that a Mac OSX bug? Am I doing something wrong?

[toc] | [next] | [standalone]


#9026

From"Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com>
Date2011-08-18 03:23 +0200
Message-ID<j2hpia$ibs$1@dont-email.me>
In reply to#9016
On 18.08.2011 00:07, meskio wrote:
> I get a runtime_error while porting a program to Mac OSX 10.6 with
> std::locale.
>
> #include<locale>
> int main ( int argc, char *argv [] ) {
>      std::locale mylocale("");
>      return 0;
> }
>
> Returns an error for any locale diferent than "C":
> bash-3.2$ LANG=es_ES.UTF-8 ./locale
> terminate called after throwing an instance of 'std::runtime_error'
>    what():  locale::facet::_S_create_c_locale name not valid
> Abort trap
>
>
> Is that a Mac OSX bug? Am I doing something wrong?

Sounds like a bug. The C locale and the "" locale (user's default) 
should be supported. Anything else you can't count on, but those two 
need to be supported if I recall correctly, which I'm pretty sure I do.

Cheers & hth.,

- Alf

[toc] | [prev] | [next] | [standalone]


#9052

FromNobody <nobody@nowhere.com>
Date2011-08-18 18:44 +0100
Message-ID<pan.2011.08.18.17.44.30.295000@nowhere.com>
In reply to#9026
On Thu, 18 Aug 2011 03:23:22 +0200, Alf P. Steinbach wrote:

> Sounds like a bug. The C locale and the "" locale (user's default) 
> should be supported.

That assumes that the user's default locale is a valid locale. The OS
won't prevent you from setting LANG etc to an invalid locale.

Which locales are valid may vary between individual systems, even for the
same architecture and OS.

[toc] | [prev] | [next] | [standalone]


#9108

FromVaclav Zeman <vzeman79@sh.cvut.cz>
Date2011-08-20 12:35 +0200
Message-ID<4E4F8DF7.60907@sh.cvut.cz>
In reply to#9016
meskio wrote, On 18.8.2011 0:07:
> I get a runtime_error while porting a program to Mac OSX 10.6 with
> std::locale.
> 
> #include <locale>
> int main ( int argc, char *argv [] ) {
>     std::locale mylocale("");
>     return 0;
> }
> 
> Returns an error for any locale diferent than "C":
> bash-3.2$ LANG=es_ES.UTF-8 ./locale
> terminate called after throwing an instance of 'std::runtime_error'
>   what():  locale::facet::_S_create_c_locale name not valid
> Abort trap
This happens when GCC is not configured with locale support. See
<http://gcc.gnu.org/onlinedocs/libstdc++/manual/configure.html>, the
--enable-clocale option.

> 
> 
> Is that a Mac OSX bug? Am I doing something wrong?
It might be that MacOS X does not support what GNU libstdc++ needs/wants to
implement fully functional std::locale. I cannot tell as I do not use that OS.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web