Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4658: (boost::format("%u") % (unsigned char)2).str(); error result
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-10-12 17:58:58
#4658: (boost::format("%u") % (unsigned char)2).str(); error result
---------------------------+--------------------------------
Reporter: anonymous | Owner: James E. King, III
Type: Bugs | Status: assigned
Milestone: Boost 1.44.0 | Component: format
Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
---------------------------+--------------------------------
Comment (by James E. King, III):
#9360 also details the following, which I verified:
{{{
// https://svn.boost.org/trac10/ticket/9360
unsigned char c = 0x55;
s = (boost::format("0x%02X") % c).str();
BOOST_CHECK_EQUAL(std::string("0x55"), s);
Running 1 test case...
format_test3.cpp(134): error: in "test_main_caller(_argc,_argv_)": check
std::string("0x55") == s has failed [0x55 != 0x0U]
}}}
If you change the type of c to an unsigned short, or unsigned int, then
the check passes, so it is specific to char handling, just as the original
report here.
-- Ticket URL: <https://svn.boost.org/trac10/boost/ticket/4658#comment:2> 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-10-12 18:28:54 UTC