|
Boost : |
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2007-03-04 09:38:40
Zack wrote:
> Consider the following example program:
>
> #include <boost/format.hpp>
> #include <cstdio>
> #include <string>
>
> int main()
> {
> unsigned char n = 65;
> std::printf("%u\n", n);
> std::puts((boost::format("%u") % n).str().c_str());
> }
>
> $ g++ test.cc
> $ ./a.out
> 65
> A
>
> 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.
Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk