Boost logo

Boost :

From: Kevlin Henney (Kevlin.Henney_at_[hidden])
Date: 1999-07-28 15:06:32

The alternative is to provide a template based solution, rather than death
by a thousand typedefs/#defines. I did something like this, and outlined
the details in a couple of articles for Overload when Sean was editing it a
few years ago. I'd be happy to dig it up and submit the code as a library.



Beman Dawes <beman_at_[hidden]> on 28/07/99 17:38:46

Please respond to boost_at_[hidden]

To: " mailing list" <boost_at_[hidden]>
cc: (bcc: Kevlin Henney/QA Training Ltd)
Subject: [boost] Stdint header?

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.)

Possible answers:

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,
events, IMO.)

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
reasons stated.



Click Here to apply for a NextCard Internet Visa and start earning
FREE travel in HALF the time with the NextCard Rew_at_rds Program. home: - Simplifying group communications

Boost list run by bdawes at, gregod at, cpdaniel at, john at