Re: [Boost-bugs] [Boost C++ Libraries] #11878: Locale dependend number formatting doesn't work with MSVC release config

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11878: Locale dependend number formatting doesn't work with MSVC release config
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-12-30 09:21:18


#11878: Locale dependend number formatting doesn't work with MSVC release config
--------------------------------+---------------------
  Reporter: octavian.cacina@… | Owner: artyom
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: locale
   Version: Boost 1.60.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------+---------------------

Comment (by octavian.cacina@…):

 Replying to [comment:5 artyom]:
> So please provide (as comands list:

 boost build
 {{{
 D:\LIBS\boost_1_60_0>b2 -d+2 --debug-building link=static threading=multi
 runtime-link=shared stage
 }}}

 I've used -d+2 and --debug-building to see the used compilation flags.

 Extract from the boost building output
 {{{
 file bin.v2\libs\locale\build\msvc-14.0\release\link-static\threading-
 multi\win32\win_backend.obj.rsp
 "libs\locale\src\win32\win_backend.cpp"
 -Fo"bin.v2\libs\locale\build\msvc-14.0\release\link-static\threading-
 multi\win32\win_backend.obj" -TP /O2 /Ob2 /W3 /GR /MD /Zc:forScope
 /Zc:wchar_t /wd4675 /EHs -c
 -DBOOST_ALL_NO_LIB=1
 -DBOOST_LOCALE_NO_POSIX_BACKEND=1
 -DBOOST_SYSTEM_STATIC_LINK=1
 -DBOOST_THREAD_NO_LIB=1
 -DNDEBUG
 "-I."
 compile-c-c++ bin.v2\libs\locale\build\msvc-14.0\release\link-static
 \threading-multi\win32\win_backend.obj

     call "C:\Users\Tavi\AppData\Local\Temp\b2_msvc_14.0_vcvarsall_x86.cmd"
>nul
 cl /Zm800 -nologo @"bin.v2\libs\locale\build\msvc-14.0\release\link-static
 \threading-multi\win32\win_backend.obj.rsp"

 ...

 link /lib /NOLOGO /out:"bin.v2\libs\locale\build\msvc-14.0\release\link-
 static\threading-multi\libboost_locale-vc140-mt-1_60.lib"
 @"bin.v2\libs\locale\build\msvc-14.0\release\link-static\threading-multi
 \libboost_locale-vc140-mt-1_60.lib.rsp"

 copy /b "bin.v2\libs\locale\build\msvc-14.0\release\link-static\threading-
 multi\libboost_locale-vc140-mt-1_60.lib" + this-file-does-not-exist-
 A698EE7806899E69 "stage\lib\libboost_locale-vc140-mt-1_60.lib"

 }}}

 For this test, I used the command line and exactly the same flags as used
 by boost.
 I've copied the generated b2_msvc_14.0_vcvarsall_x86.cmd to have the same
 environment: path, include and libpath.

 Build the test app:
 {{{
 call b2_msvc_14.0_vcvarsall_x86.cmd
 cl "LocaleNumPunct.cpp" /Zm800 -nologo -DNDEBUG -TP /O2 /Ob2 /W3 /GR /MD
 /Zc:forScope /Zc:wchar_t /wd4675 /EHs /I"D:\LIBS\boost_1_60_0" /link
 "libboost_locale-vc140-mt-1_60.lib" "libboost_system-vc140-mt-1_60.lib"
 /LIBPATH:"D:\LIBS\boost_1_60_0\stage\lib"
 }}}

 LocaleNumPunct.cpp
 {{{#!c++
 #include <locale>
 #include <string>
 #include <iostream>

 #include "boost/locale.hpp"

 int main()
 {
   using namespace std;

   float v = 2.14f;

   // Use std locale to format a float

   auto stdLocale = std::locale("German_germany");
   cout.imbue(stdLocale);
   cout << "std locale " << v << endl;

   auto& stdNumPunct = std::use_facet<std::numpunct<char>>(stdLocale);
   cout << "std locale decimal_point " << stdNumPunct.decimal_point() <<
 endl;

   cout << "std locale num_put ";
   auto& stdFacet = std::use_facet<std::num_put<char>>(stdLocale);
   stdFacet.put(cout, cout, '0', v);
   cout << endl;

   // Use boost locale to format a float

   boost::locale::generator gen;
   auto boostLocale = gen("de_DE.UTF-8");
   cout.imbue(boostLocale);

   cout << "boost locale " << boost::locale::as::number << v << endl;

   auto& boostNumPunct = std::use_facet<std::numpunct<char>>(boostLocale);
   cout << "boost locale decimal_point " << boostNumPunct.decimal_point()
 << endl;

   cout << "boost locale num_put ";
   auto& boostFacet = std::use_facet<std::num_put<char>>(boostLocale);
   boostFacet.put(cout, cout, '0', v);
   cout << endl;

   return 0;
 }
 }}}

 LocaleNumPunct.exe output:
 {{{
 std locale 2,14
 std locale decimal_point ,
 std locale num_put 2,14
 boost locale 2.14
 boost locale decimal_point ,
 boost locale num_put 2.14
 }}}


> Also small question: does it happen with different version of MSVC?

 Unfortunatelly, I do not have the previous MSVC at hand.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11878#comment:6>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC