#1591 C locale LC_NUMERIC suddenly changed to "C" default "."

OTHER
pending
nobody
Bug
none
Waiting_User_Response
False
2013-02-08
2011-10-27
No

While working on locale Polish_Poland.1250, having set decimal point separator to "," (comma) it suddenly changes to "." (dot).
I use C locale and call setlocale to system default (polish), but ostream::operator<<(float) seems to change my locale decimal point separator to "." ("C" locale).

Regards
dr Zielak

My BOX
----------------
Windows XP (VISTA the same problem)

$ gcc -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,jav
a,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enabl
e-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enab
le-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root
--with-mpfr=/mingw/src/mpfr/root --build=mingw32
Thread model: win32
gcc version 4.4.0 (GCC)

$ uname -a
MINGW32_NT-5.1 XXXX 1.0.11(0.46/3/2) 2009-07-11 17:46 i686 Msys

$ ld -v
GNU ld (GNU Binutils) 2.19.1

Reproduction code. Just wait for printf We got it !!
--------------------------------------

#include <sstream>
#include <windows.h>
#include <boost/property_tree/xml_parser.hpp>
#include <locale.h>

using namespace std;

unsigned long __stdcall threadFunc(void* pThis)
{
while (1)
{
float f;

if (*(localeconv()->decimal_point) == '.')
{
cout << "\n\nWe got it !!\n\n" << flush;
exit(0);
}
sscanf("12,4", "%f",&f);
cout << '[' << f << ']'<< flush;
printf("{%f}", f);

}
}

int main(int argc, char* argv[])
{
cout << setlocale(LC_ALL, "") << flush;
::CreateThread(NULL, 0, threadFunc, 0, 0, NULL);
::CreateThread(NULL, 0, threadFunc, 0, 0, NULL);

while (1)
::Sleep(1000);
}

Discussion

  •  
    Attachments
  • Earnie Boyd
    Earnie Boyd
    2012-11-12

    Is this still an issue with current GCC?

     
  • Earnie Boyd
    Earnie Boyd
    2012-11-12

    • milestone: --> Waiting_User_Response
    • status: open --> pending
     
  • I do not know. I am still on the same gcc.

     
    • status: pending --> open
     
  • Earnie Boyd
    Earnie Boyd
    2013-01-21

    • status: open --> pending
    • resolution: --> out-of-date
    • category: --> Waiting_User_Response
    • milestone: Waiting_User_Response --> OTHER
     
  • Earnie Boyd
    Earnie Boyd
    2013-01-21

    You will need to test with the newest GCC to determine if it is still an issue. I suspect that it will be and I don't think GCC is the bug but the Windows API but could possibly be a libstdc++ issue.

     
  • I checked it on the same gcc version
    Windows 7, problem still does exist. I do not have a chance to check it on newer gcc

     
  • Earnie Boyd
    Earnie Boyd
    2013-02-08

    • labels: gcc --> gcc, current?
    • type: --> Bug
    • resolution: out-of-date --> none
    • patch_attached: --> False