Re: [boost] boost::format - incorrect (printf-incompatible) handling of "%u" with characters

On 3/4/07, Phil Endecott <phil_ntaqi_endecott@chezphil.org> wrote:
In my opinion this is a bug - both operations should produce "65".
See my previous report:
http://thread.gmane.org/gmane.comp.lib.boost.user/23644 which continues at http://thread.gmane.org/gmane.comp.lib.boost.user/23664
The conclusion at that time was that - you can just cast to an int if this is what you want. - you shouldn't be using bytes to store numbers - that's unnecessary size optimisation.
I didn't agree with those conclusions, and I'm no longer using boost::format.
Yeah, I don't agree with those conclusions either. Not all uses of 8-bit numbers are unnecessary size optimization. Image data, for example, commonly comes as 8 bits per pixel per color, and you may want to print out the numeric values for debugging. Stream ciphers are often defined to produce one byte at a time of keystream. In the case that prompted this bug report, I was using 8-bit numbers as a *time* optimization hint - the compiler needed to know that a narrowing divide was safe. [What did you replace boost::format with?] zw
participants (1)
-
Zack Weinberg