Enhancement: format (u)int8 types correctly to number, if formatted with %d, &i, %u
If I try to format a (u)int8 number, Boost.Format considers this as (unsigned) char, even if I use %d, %i or %u.
This is a known and rather old issue.
The workaround is to cast the number to (u)int32, before formatting.
Nevertheless the current behavior leads to very subtle bugs, because the developer has to check the type of the number to be printed very carefully.
Plain printf handles (u)int8 numbers in combination with %d, %i or %u correctly.
Boost version: 1.68 (32bit) Compiler: MSVC 15.8
Just faced with the same issue trying to format GUID to its string representation. I use %02X to format the last bytes, but unexpectedly it was shown as non-US-ASCII character =(.
It there any plans to fix this? cc @jeking3
I don't think this is an enhancement. This just bit me and imho it's a plain bug: i specifically ask for some kind of numeric formatting and it simply doesnt. If I specify '%x' and the argument is a string it should just throw.