
John Maddock wrote:
running sizeof on a boost::int8_t returns 1, but what is the type? int/char?
Strictly speaking you're not allowed to ask that question... it's a secret :-)
The idea is that int8_t is whatever platform-dependent type has 8-bits and is signed.
But since you ask, it's "signed char" on any platform you're ever likely to encounter. You should never make any assumptions about the actual types of the int#_t typedefs though - some of them really are "unmentionable" platform dependent types on some platforms - but take a look at boost/cstdint.hpp for the details.
HTH, John.
This is a subject I accidently revisited recently. I wanted a arithmetic type that was only 8 bits long. boost::int8_t seemed just the ticket. But then when one did something like boost::int8_t i; std::cout << i; One usually wouldn't get what he would expect. To me this is a big "hole" in the whole concept. What I would really like to see is: int8_t defined with something like BOOST_SERIALIZATION_STRONGTYPEDEF so that int8_t becomes a true type rather than just a "macro" of some other type. To me - we should have a whole new set of (true) numeric types and start to use them. I sort of suspect that C99 had this intention, but by using typedef to implement them, they aren't useful for my needs. Perhaps the "mistake" is not having typedef create a truely new type. Or maybe a new keyword "strong_typedef". I realize that fixing this would be a herculean task at this point so this isn't a real suggestion - its really just a rant. But it makes me feel better. Robert Ramey