3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Standard Integer Types
</title>
5 <link rel=
"stylesheet" href=
"../../../../../doc/src/boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../index.html" title=
"Boost.Config">
8 <link rel=
"up" href=
"../index.html" title=
"Boost.Config">
9 <link rel=
"prev" href=
"build_config.html" title=
"Build Time Configuration">
10 <link rel=
"next" href=
"guidelines_for_boost_authors.html" title=
"Guidelines for Boost Authors">
12 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
13 <table cellpadding=
"2" width=
"100%"><tr>
14 <td valign=
"top"><img alt=
"Boost C++ Libraries" width=
"277" height=
"86" src=
"../../../../../boost.png"></td>
15 <td align=
"center"><a href=
"../../../../../index.html">Home
</a></td>
16 <td align=
"center"><a href=
"../../../../../libs/libraries.htm">Libraries
</a></td>
17 <td align=
"center"><a href=
"http://www.boost.org/users/people.html">People
</a></td>
18 <td align=
"center"><a href=
"http://www.boost.org/users/faq.html">FAQ
</a></td>
19 <td align=
"center"><a href=
"../../../../../more/index.htm">More
</a></td>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"build_config.html"><img src=
"../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../index.html"><img src=
"../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../index.html"><img src=
"../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"guidelines_for_boost_authors.html"><img src=
"../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both">
27 <a name=
"boost_config.cstdint"></a><a class=
"link" href=
"cstdint.html" title=
"Standard Integer Types">Standard Integer Types
</a>
28 </h2></div></div></div>
30 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.overview">Overview
</a></span></dt>
31 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.rationale">Rationale
</a></span></dt>
32 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.ce"><span class=
"emphasis"><em>Caveat emptor
</em></span></a></span></dt>
33 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.exact_width_integer_types">Exact-width
34 integer types
</a></span></dt>
35 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.minimum_width_integer_types">Minimum-width
36 integer types
</a></span></dt>
37 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.fastest_minimum_width_integer_types">Fastest
38 minimum-width integer types
</a></span></dt>
39 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.greatest_width_integer_types">Greatest-width
40 integer types
</a></span></dt>
41 <dt><span class=
"section"><a href=
"cstdint.html#boost_config.cstdint.integer_constant_macros">Integer
42 Constant Macros
</a></span></dt>
45 <div class=
"titlepage"><div><div><h3 class=
"title">
46 <a name=
"boost_config.cstdint.overview"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.overview" title=
"Overview">Overview
</a>
47 </h3></div></div></div>
49 The header
<code class=
"literal"><a href=
"../../../../../boost/cstdint.hpp" target=
"_top"><boost/cstdint.hpp
></a></code>
50 provides the typedef's useful for writing portable code that requires certain
51 integer widths. All typedef's are in namespace boost.
54 The specifications for these types are based on the ISO/IEC
9899:
1999 C Language
55 standard header
<stdint.h
>. The
64-bit types required by the C standard
56 are
<span class=
"emphasis"><em>not required
</em></span> in the boost header, and may not be
57 supplied for all platforms/compilers, because
<code class=
"literal">long long
</code>
58 is not [yet] included in the C++ standard.
61 See
<a href=
"../../../test/cstdint_test.cpp" target=
"_top">cstdint_test.cpp
</a> for
66 <div class=
"titlepage"><div><div><h3 class=
"title">
67 <a name=
"boost_config.cstdint.rationale"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.rationale" title=
"Rationale">Rationale
</a>
68 </h3></div></div></div>
70 The organization of the Boost.Integer headers and classes is designed to
71 take advantage of
<stdint.h
> types from the
1999 C standard without
72 causing undefined behavior in terms of the
1998 C++ standard. The header
73 <boost/cstdint.hpp
> makes the standard integer types safely available
74 in namespace
<code class=
"literal">boost
</code> without placing any names in namespace
75 <code class=
"literal">std
</code>. The intension is to complement rather than compete
76 with the C++ Standard Library. Should some future C++ standard include
<stdint.h
>
77 and
<cstdint
>, then
<boost/cstdint.hpp
> will continue to function,
78 but will become redundant and may be safely deprecated.
81 Because these are boost headers, their names conform to boost header naming
82 conventions rather than C++ Standard Library header naming conventions.
86 <div class=
"titlepage"><div><div><h3 class=
"title">
87 <a name=
"boost_config.cstdint.ce"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.ce" title=
"Caveat emptor"><span class=
"emphasis"><em>Caveat emptor
</em></span></a>
88 </h3></div></div></div>
90 As an implementation artifact, certain C
<limits.h
> macro names may
91 possibly be visible to users of
<boost/cstdint.hpp
>. Don't use these
92 macros; they are not part of any Boost-specified interface. Use
<code class=
"literal">boost::integer_traits
<></code>
93 or
<code class=
"literal">std::numeric_limits
<></code> instead.
96 As another implementation artifact, certain C
<stdint.h
> typedef names
97 may possibly be visible in the global namespace to users of
<boost/cstdint.hpp
>.
98 Don't use these names, they are not part of any Boost-specified interface.
99 Use the respective names in namespace
<code class=
"literal">boost
</code> instead.
102 <div class=
"section">
103 <div class=
"titlepage"><div><div><h3 class=
"title">
104 <a name=
"boost_config.cstdint.exact_width_integer_types"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.exact_width_integer_types" title=
"Exact-width integer types">Exact-width
106 </h3></div></div></div>
108 The typedef
<code class=
"literal">int#_t
</code>, with # replaced by the width, designates
109 a signed integer type of exactly # bits; for example
<code class=
"literal">int8_t
</code>
110 denotes an
8-bit signed integer type. Similarly, the typedef
<code class=
"literal">uint#_t
</code>
111 designates an unsigned integer type of exactly # bits.
114 These types are optional. However, if a platform supports integer types with
115 widths of
8,
16,
32,
64, or any combination thereof, then
<boost/cstdint.hpp
>
116 does provide the corresponding typedefs.
119 The absence of int64_t and uint64_t is indicated by the macro
<code class=
"computeroutput"><span class=
"identifier">BOOST_NO_INT64_T
</span></code>.
122 <div class=
"section">
123 <div class=
"titlepage"><div><div><h3 class=
"title">
124 <a name=
"boost_config.cstdint.minimum_width_integer_types"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.minimum_width_integer_types" title=
"Minimum-width integer types">Minimum-width
126 </h3></div></div></div>
128 The typedef
<code class=
"literal">int_least#_t
</code>, with # replaced by the width,
129 designates a signed integer type with a width of at least # bits, such that
130 no signed integer type with lesser size has at least the specified width.
131 Thus,
<code class=
"literal">int_least32_t
</code> denotes the smallest signed integer
132 type with a width of at least
32 bits. Similarly, the typedef name
<code class=
"literal">uint_least#_t
</code>
133 designates an unsigned integer type with a width of at least # bits, such
134 that no unsigned integer type with lesser size has at least the specified
138 The following minimum-width integer types are provided for all platforms:
140 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
141 <li class=
"listitem">
142 <code class=
"literal">int_least8_t
</code>
144 <li class=
"listitem">
145 <code class=
"literal">int_least16_t
</code>
147 <li class=
"listitem">
148 <code class=
"literal">int_least32_t
</code>
150 <li class=
"listitem">
151 <code class=
"literal">uint_least8_t
</code>
153 <li class=
"listitem">
154 <code class=
"literal">uint_least16_t
</code>
156 <li class=
"listitem">
157 <code class=
"literal">uint_least32_t
</code>
161 The following types are available only if, after including
<boost/cstdint.hpp
>,
162 the macro BOOST_NO_INT64_T is not defined:
164 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
165 <li class=
"listitem">
166 <code class=
"literal">int_least64_t
</code>
168 <li class=
"listitem">
169 <code class=
"literal">uint_least64_t
</code>
173 All other minimum-width integer types are optional.
176 <div class=
"section">
177 <div class=
"titlepage"><div><div><h3 class=
"title">
178 <a name=
"boost_config.cstdint.fastest_minimum_width_integer_types"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.fastest_minimum_width_integer_types" title=
"Fastest minimum-width integer types">Fastest
179 minimum-width integer types
</a>
180 </h3></div></div></div>
182 The typedef
<code class=
"literal">int_fast#_t
</code>, with # replaced by the width,
183 designates the fastest signed integer type with a width of at least # bits.
184 Similarly, the typedef name
<code class=
"literal">uint_fast#_t
</code> designates the
185 fastest unsigned integer type with a width of at least # bits.
188 There is no guarantee that these types are fastest for all purposes. In any
189 case, however, they satisfy the signedness and width requirements.
192 The following fastest minimum-width integer types are provided for all platforms:
194 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
195 <li class=
"listitem">
196 <code class=
"literal">int_fast8_t
</code>
198 <li class=
"listitem">
199 <code class=
"literal">int_fast16_t
</code>
201 <li class=
"listitem">
202 <code class=
"literal">int_fast32_t
</code>
204 <li class=
"listitem">
205 <code class=
"literal">uint_fast8_t
</code>
207 <li class=
"listitem">
208 <code class=
"literal">uint_fast16_t
</code>
210 <li class=
"listitem">
211 <code class=
"literal">uint_fast32_t
</code>
215 The following types are available only if, after including
<boost/cstdint.hpp
>,
216 the macro BOOST_NO_INT64_T is not defined:
218 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
219 <li class=
"listitem">
220 <code class=
"literal">int_fast64_t
</code>
222 <li class=
"listitem">
223 <code class=
"literal">uint_fast64_t
</code>
227 All other fastest minimum-width integer types are optional.
230 <div class=
"section">
231 <div class=
"titlepage"><div><div><h3 class=
"title">
232 <a name=
"boost_config.cstdint.greatest_width_integer_types"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.greatest_width_integer_types" title=
"Greatest-width integer types">Greatest-width
234 </h3></div></div></div>
236 The typedef
<code class=
"literal">intmax_t
</code>designates a signed integer type
237 capable of representing any value of any signed integer type.
240 The typedef
<code class=
"literal">uintmax_t
</code> designates an unsigned integer type
241 capable of representing any value of any unsigned integer type.
244 These types are provided for all platforms.
247 <div class=
"section">
248 <div class=
"titlepage"><div><div><h3 class=
"title">
249 <a name=
"boost_config.cstdint.integer_constant_macros"></a><a class=
"link" href=
"cstdint.html#boost_config.cstdint.integer_constant_macros" title=
"Integer Constant Macros">Integer
251 </h3></div></div></div>
253 The following macros are always defined after inclusion of this header, these
254 allow integer constants of at least the specified width to be declared: INT8_C,
255 UINT8_C, INT16_C, UINT16_C, INT32_C, UINT32_C, INTMAX_C, UINTMAX_C.
258 The macros INT64_C and UINT64_C are also defined if the the macro BOOST_NO_INT64_T
262 The C99 macro __STDC_CONSTANT_MACROS is also defined as an artifact of the
268 <pre class=
"programlisting"><span class=
"preprocessor">#include
</span> <span class=
"special"><</span><span class=
"identifier">boost
</span><span class=
"special">/
</span><span class=
"identifier">cstdint
</span><span class=
"special">.
</span><span class=
"identifier">hpp
</span><span class=
"special">></span>
270 <span class=
"comment">// Here the constant
0x1FFFFFFFF has the correct suffix applied:
</span>
271 <span class=
"keyword">static
</span> <span class=
"keyword">const
</span> <span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">uint64_t
</span> <span class=
"identifier">c
</span> <span class=
"special">=
</span> <span class=
"identifier">INT64_C
</span><span class=
"special">(
</span><span class=
"number">0</span><span class=
"identifier">x1FFFFFFFF
</span><span class=
"special">);
</span>
275 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
276 <td align=
"left"></td>
277 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2001-
2007 Beman Dawes, Vesa Karvonen, John
279 Distributed under the Boost Software License, Version
1.0. (See accompanying
280 file LICENSE_1_0.txt or copy at
<a href=
"http://www.boost.org/LICENSE_1_0.txt" target=
"_top">http://www.boost.org/LICENSE_1_0.txt
</a>)
285 <div class=
"spirit-nav">
286 <a accesskey=
"p" href=
"build_config.html"><img src=
"../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../index.html"><img src=
"../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../index.html"><img src=
"../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"guidelines_for_boost_authors.html"><img src=
"../../../../../doc/src/images/next.png" alt=
"Next"></a>