From: Beman Dawes (beman_at_[hidden])
Date: 1999-07-28 11:38:46
Background: The new C9X C Langauge standard has added a header
<stdint.h> which declares integer types with specified widths and
corresponding MIN/MAX macros. The typedefs have names like int32_t,
int_least32_t, int_fast32_t, and intmax_t. The C++ standard doesn't
supply this header.
The Question: How can Boost authors access specified width integers?
(This isn't theoretical; there are at least two boost projects
underway that need specific integer widths.)
1) #include <stdint.h>, and supply a version for systems which don't
already have one. Cons: The names go in the global namespace, and it
seems like a C rather than C++ solution.
2) #include <cstdint>, and supply a version (with names in namespace
std) for systems which don't already have one. At least one compiler
vendor is already doing this. Pros: Minimum future impact if C++
eventually standardizes <cstdint>. Cons: The C++ committee may never
standardize <cstdint> or may standardize it in a way incompatible
with C. (These seem low probability, or even very low probability,
3) #include <boost/stdint.hpp>, and supply same. Names in namespace
boost. Cons: If <cstdint> becomes either common or standardized,
Boost is out-of-step.
4) #include <boost/our_name.hpp>, and supply same. Namespace boost,
and use names different from <stdint.h> names. Cons: Why fight a
standard? Boost should support existing standards, even if a bit
5) and 6) Too brain-dead to bother explaining.
At first, I only considered (3), but then in came a compiler release
with <cstdint> supplied. It took some getting used to, but now (2)
is starting to look better. I don't really like (1) or (4) for the
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk