incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: 22.locale.moneypunct test fails on MSVC
Date Wed, 03 Oct 2007 20:20:59 GMT
Farid Zaripov wrote:
>   The 22.locale.moneypunct test fails on MSVC (and ICC/Windows)
> due to bug of the CRT or native API.
> 
>   The following program aborts on assert (tested on all
> MSVC's on Windows XP 32 and 64 bit). This program fails
> only for some locales. So it fails with locname = "Catalan_Spain.1252"
> but succeeds with locname = "Russian_Russia.1251".

Hmm. That makes the LC_MONETARY category pretty much unusable
on Windows. We need to open a bug with Microsoft and get this
fixed. But we should also try to work around the bug. Does
using LC_ALL instead of LC_MONETARY work? If not, we might
need to step through their runtime library to see what causes
the bug and try to avoid running into it, maybe by using the
native Win32 API directly.

Martin

> 
> -----------------------
> #include <clocale>
> #include <cstring>
> #include <cassert>
> #include <cstdio>
> 
> int main(int argc, char* argv[])
> {
>     const char* locname = "Catalan_Spain.1252";
> 
>     std::setlocale (LC_ALL, "C");
> 
>     std::setlocale (LC_MONETARY, locname);
>     const lconv* pconv = std::localeconv ();
>     char curr = pconv->currency_symbol [0];
> 
>     std::setlocale (LC_ALL, "C");
> 
>     std::setlocale (LC_ALL, locname);
>     pconv = std::localeconv ();
>     char curr2 = pconv->currency_symbol [0];
> 
>     std::printf ("curr = %d\n", int (curr));
>     std::printf ("curr2 = %d\n", int (curr2));
> 
>     assert (curr == curr2);
> 
>     return 0;
> }  
> -----------------------
> 
>   The program output:
> -----------------------
> curr = -120
> curr2 = -128
> Assertion failed: curr == curr2, file
> d:\_projects\locbug\locbug\locbug.cpp, line 29
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> -----------------------
> 
> Farid.
> 


Mime
View raw message