PATCH: Re: iostream changes locale to format a number

Benjamin Kosnik bkoz@redhat.com
Sat May 4 10:05:00 GMT 2002


Hey Paolo, Takeshi, thanks.

Takeshi, your patch looks good: perhaps Paolo could check it in?

Paolo, your testcase looks good. However, can you localize it to just
the locale bits, instead of locales + io? Here's an example: it would be
nice to test for this in all the facets that use this idiom, or
pre-emptively for all facets (like the testsuite additions for 5280),
since this kind of bug is something that should not re-appear, ever.

 
Index: testsuite/22_locale/num_put_members_char.cc
===================================================================
RCS file:
/cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/num_put_members_char.cc,v
retrieving revision 1.6 diff -c -p -r1.6 num_put_members_char.cc
*** testsuite/22_locale/num_put_members_char.cc	1 Feb 2002 00:24:12 -0000	
1.6
--- testsuite/22_locale/num_put_members_char.cc	4 May 2002 17:03:45 -0000
*************** void test03()
*** 310,320 ****
--- 310,331 ----
  #endif
  }
  
+ void test04()
+ {
+   bool test = true;
+   std::string loc1 = setlocale(LC_ALL, "de_DE");
+   test01();
+   test02();
+   std::string loc2 = setlocale(LC_ALL, NULL);
+   VERIFY( loc1 == loc2 );
+ }
+ 
  int main()
  {
    test01();
    test02();
    test03();
+   test04();
    return 0;
  }
  
Sadly, I cannot actually test this now. Sorry. However, I think you get
the idea.

If I don't see the Barry McGee show at Paule Anglim before I leave SF
today I'll regret if for the rest of my life, so sorry about flaking on
this one. Paolo, I trust you to do the right thing, patch pre-approved.

-benjamin 



More information about the Libstdc++ mailing list