public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: cygwin@cygwin.com
Subject: Re: std::runtime_error on std::locale("")
Date: Fri, 22 Sep 2023 09:20:54 +0200	[thread overview]
Message-ID: <c9d90b5c-5aad-97d1-8559-0a7686f29a7f@t-online.de> (raw)
In-Reply-To: <20230922130838.ced40a712c8a4de95be6d5a4@nifty.ne.jp>

Takashi Yano via Cygwin wrote:
> On Thu, 21 Sep 2023 21:06:59 +0200
> Christian Franke wrote:
>> ...
>> According to libstdc++ source, the internal function
>> locale::facet::_S_create_c_locale() calls some __newlocale() which
>> apparently does not arrive at newlocale() from cygwin1.dll. But
>> cygstdc++-6.dll imports newlocale() from cygwin1.dll.
> Thanks for the pointer. I looked into the cygstdc++6.dll source code,
> and noticed that the code you mentioned is for glibc. In glibc,
> __newlocale() is defined and newlocale() is a weak alias for that.
>
> For generic libc (i.e. other than glibc), _S_create_c_locale() is
> defined as:
>
>    void
>    locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
>                      __c_locale)
>    {
>      // Currently, the generic model only supports the "C" locale.
>      // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
>      __cloc = 0;
>      if (strcmp(__s, "C"))
>        __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
>                  "name not valid"));
>    }
>
> in /libstdc++-v3/config/locale/generic/c_locale.cc.

Thanks for clarification. Same applies to MinGW-w64 runtime.

The reason why cygstdc++-6.dll imports newlocale() and other *locale() 
from cygwin1.dll are only the C++17 std::from_chars() functions 
(src/c++17/floating_from_chars.cc). These switch temporarily to "C" 
locale. MinGW-w64 does not support these.

-- 
Regards,
Christian


  reply	other threads:[~2023-09-22  7:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 16:12 Takashi Yano
2023-09-21 16:28 ` Takashi Yano
2023-09-21 18:08   ` Brian Inglis
2023-09-21 19:06     ` Christian Franke
2023-09-22  4:08       ` Takashi Yano
2023-09-22  7:20         ` Christian Franke [this message]
2023-09-22  5:56       ` Martin Wege
2023-09-22 12:01         ` Brian Inglis
2023-09-22  6:48 ` ASSI
2023-09-23  8:23   ` Takashi Yano
2023-09-23  8:42     ` Takashi Yano
2023-09-27 10:50     ` Takashi Yano
2023-12-31  6:57       ` Takashi Yano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9d90b5c-5aad-97d1-8559-0a7686f29a7f@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).