|
Boost : |
From: Beman Dawes (beman_at_[hidden])
Date: 1999-08-05 15:59:27
At 06:03 AM 8/5/99 -1000, Thomas Plum wrote:
>I want to provide some arguments for making use of, and encouraging
>the use of, the <stdint.h> as defined in C9X (or indirectly thru a
>boost-specific <stdint.hpp> or whatever).
>
> [snip]
>
>Just a plea to focus the creative effort upon the other problems,
where
>there is clearly no opportunity for common C/C++ solutions ...
I agree with you as regards the C stdint.h typedefs. In addition to
your arguments, it seems to me that the int32_t, int_least32, etc.
typedefs are simply easier to understand and use than other
approaches for many basic programming tasks.
So the C stdint.h typedefs (or the same content in namespace boost)
are a firm foundation.
I assume you don't have any problem with layering added functionality
on top of it, such as Valentin's "checked integers" or "choosers", as
long as that added functionality is build on the stdint.h typedefs,
not competing with them.
But what about the macros in stdint.h? Since the C committee had
foresight enough to put guards around them so they must be explicitly
invoked, boost can use stdint.h without automatically defining
macros. Providing a C++ traits class to get at max, min, and other
traits is a distinct technical advantage for generic programming with
templates, and because a traits class obeys scope rules which macros
don't. Do you have a problem with boost providing a traits class and
requesting boost authors use something like
integer_traits<int32_t>::max or numeric_limits<int32_t>::max() rather
using the stdint.h macros?
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk