c++boost.gif (8819 bytes) Home Libraries People FAQ More

Boost Integer Library

Header / Docs Contents Use
<boost/cstdint.hpp>

documentation
Contents of <boost/stdint.h> wrapped in namespace boost. Supplies typedefs for standard integer types such as int32_t or uint_least16_t. Use in preference to <stdint.h> or <boost/stdint.h> because the names are safely placed in the boost namespace.
<boost/stdint.h> Typedefs as defined in the C99 standard header <stdint.h>. This implementation #includes the compiler supplied <stdint.h>, if present. Supplied for use in the implementation of <boost/cstdint.hpp> and to ease transition to the C99 standard. Other uses are not recommended because this header places its names in the global namespace. 
<boost/integer_traits.hpp>

documentation
Template class boost::integer_traits, derived from std::numeric_limits.  Adds const_min and const_max members. Use to obtain the characteristics of a known integer type.
<boost/integer.hpp>

documentation
Templates for integer type selection based on properties such as maximum value or number of bits. Use to select the type an integer when some property such as maximum value or number of bits is known. Useful for generic programming.

Rationale

The organization of boost integer headers and classes is designed to take advantage of <stdint.h> types from in the 1999 C standard without resorting to undefined behavior in terms of the 1998 C++ standard.  The header <boost/cstdint.hpp> makes the standard integer types safely available in namespace boost without placing any names in the global namespace or namespace std. As always, the intension is to complement rather than compete with the C++ Standard Library.  Should some future C++ standard include <stdint.h> and <cstdint>, then <boost/stdint.h> and <boost/cstdint.hpp> will continue to function, but will become redundant and may be safely deprecated.

Because these are boost headers, their names conform to boost header naming conventions rather than C++ Standard Library header naming conventions.  An exception is <boost/stdint.h> which uses a .h extension to indicate its C rather than C++ heritage.

Caveat emptor

As an implementation artifact, certain C <limits.h> macro names may possibly be visible to users of <boost/cstdint.hpp>.  Don't use these macros; they are not part of any Boost specified interface.  Use boost:: integer_traits<> or std::numeric_limits<> instead.


Revised: 05 Mar 2000