Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Header boost/cstdint.hpp 

The header <boost/cstdint.hpp> provides the typedef's useful for writing portable code that requires certain integer widths. All typedef's are in namespace boost.

The specifications are based on the ISO/IEC 9899:1999 C Language standard header <stdint.h>.  The 64-bit types required by the C standard are not required in the boost header, and may not be supplied in all implementations, because long long is not [yet] included in the C++ standard.

See cstdint_test.cpp for a test program.

Exact-width integer types

The typedef int#_t, with # replaced by the width, designates a signed integer type of exactly # bits; int8_t denotes an 8-bit signed integer type.  Similarly, the typedef uint#_t designates and unsigned integer type of exactly # bits.

These types are optional. However, if an implementation provides integer types with widths of 8, 16, 32, or 64 bits, it shall define the corresponding typedef names.

Minimum-width integer types

The typedef int_least#_t, with # replaced by the width,  designates a signed integer type with a width of at least # bits, such that no signed integer type with lesser size has at least the specified width. Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits. Similarly, the typedef name uint_least#_t designates an unsigned integer type with a width of at least # bits, such that no unsigned integer type with lesser size has at least the specified width.

Required minimum-width integer types:

All other minimum-width integer types are optional.

Fastest minimum-width integer types

The typedef int_fast#_t, with # replaced by the width, designates the fastest signed integer type with a width of at least # bits. Similarly, the typedef name uint_fast#_t designates the fastest unsigned integer type with a width of at least # bits.

There is no guarantee that these types are fastest for all purposes.  In any case, however, they satisfy  the signedness and width requirements.

Required fastest minimum-width integer types:

All other fastest minimum-width integer types are optional.

Greatest-width integer types

The typedef intmax_t designates a signed integer type capable of representing any value of any signed integer type.

The typedef uintmax_t designates an unsigned integer type capable of representing any value of any unsigned integer type.

These types are required.


Revised 06 Nov 2007

© Copyright Beman Dawes 2000

Distributed under the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt