Opened 8 years ago

Closed 5 years ago

#10245 closed Bugs (duplicate)

Boost::Format autocasts to character when I told it a number

Reported by: Mikhail Kandel <kandel3@…> Owned by: Samuel Krempp
Milestone: To Be Determined Component: format
Version: Boost 1.56.0 Severity: Problem
Keywords: cast Cc:

Description

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,

Change History (1)

comment:1 by James E. King, III, 5 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #4658

Note: See TracTickets for help on using tickets.