[Boost-bugs] [Boost C++ Libraries] #10245: Boost::Format autocasts to character when I told it a number

Subject: [Boost-bugs] [Boost C++ Libraries] #10245: Boost::Format autocasts to character when I told it a number
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-07-25 23:59:49


#10245: Boost::Format autocasts to character when I told it a number
----------------------------------------+---------------------------
 Reporter: Mikhail Kandel <kandel3@…> | Owner: samuel_krempp
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: format
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: cast |
----------------------------------------+---------------------------
 Hi.

 I was disappointed to learn that Boost::format will print an unsigned char
 as a character despite the format string being set to an integer. This is
 different then the behavior of printf, and goes against intuition as I
 explicitly specified the datatype.

 unsigned char smallnumber = 4;
 printf("%d",smallnumber);%good
 boost::format("%d") % smallnumber; // bad, treats as char, outputs
 strange character

 It looks I'm not the only one that had this problem:
 http://stackoverflow.com/questions/1674284/boostformat-question

 Wanted to make sure the boost people knew about this,

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10245>
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:16 UTC