Boost C++ Libraries: Ticket #10245: Boost::Format autocasts to character when I told it a number https://svn.boost.org/trac10/ticket/10245 <p> Hi. </p> <p> 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. </p> <p> unsigned char smallnumber = 4; printf("%d",smallnumber);%good boost::format("%d") % smallnumber; <em> bad, treats as char, outputs strange character </em></p> <p> It looks I'm not the only one that had this problem: <a class="ext-link" href="http://stackoverflow.com/questions/1674284/boostformat-question"><span class="icon">​</span>http://stackoverflow.com/questions/1674284/boostformat-question</a> </p> <p> Wanted to make sure the boost people knew about this, </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10245 Trac 1.4.3 James E. King, III Thu, 12 Oct 2017 17:59:43 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10245#comment:1 https://svn.boost.org/trac10/ticket/10245#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> Duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4658" title="#4658: Bugs: (boost::format(&#34;%u&#34;) % (unsigned char)2).str(); error result (closed: wontfix)">#4658</a> </p> Ticket