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 13:00:47
#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:7 artyom]:
> For me it starts looking like MSVC bug.
>
You are right. I have isolated it. The dynamic release runtime ignores the
numpunct facet:
{{{#!c++
#include <locale>
#include <iostream>
/* Customized numpunct facet */
class MyNumPunct : public std::numpunct<char>
{
public:
MyNumPunct(std::size_t refs = 0) : std::numpunct<char>(refs) { }
protected:
char do_decimal_point() const override
{
std::cout << " " __FUNCTION__ " ";
return ',';
}
};
int main()
{
using namespace std;
float v = 2.14f;
// Use a modified locale
auto myLocale = std::locale(std::locale::classic(), new MyNumPunct);
cout.imbue(myLocale);
cout << "stream " << v << endl;
auto& myNumPunct = std::use_facet<std::numpunct<char>>(myLocale);
cout << "decimal_point " << myNumPunct.decimal_point() << endl;
cout << "num_put ";
auto& myFacet = std::use_facet<std::num_put<char>>(myLocale);
myFacet.put(cout, cout, '0', v);
cout << endl;
return 0;
}
}}}
Config Debug OK
{{{
stream MyNumPunct::do_decimal_point 2,14
MyNumPunct::do_decimal_point decimal_point ,
num_put MyNumPunct::do_decimal_point 2,14
}}}
Config Release static runtime (/MT) OK
{{{
stream MyNumPunct::do_decimal_point 2,14
MyNumPunct::do_decimal_point decimal_point ,
num_put MyNumPunct::do_decimal_point 2,14
}}}
Config Release dynamic runtime (/MD) BAD
{{{
stream 2.14
MyNumPunct::do_decimal_point decimal_point ,
num_put 2.14
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11878#comment:10> 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