xref: /freebsd/share/man/man7/stdint.7 (revision fe08efe680f6705e0c60beabe3e39629c655e743)
1a2a44319SMike Barcroft.\" Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
2a2a44319SMike Barcroft.\" All rights reserved.
3a2a44319SMike Barcroft.\"
4a2a44319SMike Barcroft.\" Redistribution and use in source and binary forms, with or without
5a2a44319SMike Barcroft.\" modification, are permitted provided that the following conditions
6a2a44319SMike Barcroft.\" are met:
7a2a44319SMike Barcroft.\" 1. Redistributions of source code must retain the above copyright
8a2a44319SMike Barcroft.\"    notice, this list of conditions and the following disclaimer.
9a2a44319SMike Barcroft.\" 2. Redistributions in binary form must reproduce the above copyright
10a2a44319SMike Barcroft.\"    notice, this list of conditions and the following disclaimer in the
11a2a44319SMike Barcroft.\"    documentation and/or other materials provided with the distribution.
12a2a44319SMike Barcroft.\"
13a2a44319SMike Barcroft.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14a2a44319SMike Barcroft.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15a2a44319SMike Barcroft.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16a2a44319SMike Barcroft.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17a2a44319SMike Barcroft.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18a2a44319SMike Barcroft.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19a2a44319SMike Barcroft.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20a2a44319SMike Barcroft.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21a2a44319SMike Barcroft.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22a2a44319SMike Barcroft.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23a2a44319SMike Barcroft.\" SUCH DAMAGE.
24a2a44319SMike Barcroft.\"
25a2a44319SMike Barcroft.\" $FreeBSD$
26a2a44319SMike Barcroft.\"
27beddcd8bSMike Barcroft.Dd September 15, 2002
28a2a44319SMike Barcroft.Dt STDINT 7
29a2a44319SMike Barcroft.Os
30a2a44319SMike Barcroft.Sh NAME
31a2a44319SMike Barcroft.Nm stdint
32beddcd8bSMike Barcroft.Nd "standard integer types"
33a2a44319SMike Barcroft.Sh SYNOPSIS
34a2a44319SMike Barcroft.In stdint.h
35a2a44319SMike Barcroft.Sh DESCRIPTION
36a2a44319SMike BarcroftThe
37fe08efe6SRuslan Ermilov.In stdint.h
38a2a44319SMike Barcroftheader provides source-portable integer types of a specific
39a2a44319SMike Barcroftsize, smallest memory footprint with a minimum size, fastest
40beddcd8bSMike Barcroftaccess speed with a minimum size, largest integer size, and
41beddcd8bSMike Barcroftthose capable of storing pointers.
42a2a44319SMike Barcroft.Pp
43a2a44319SMike BarcroftThe types
44a2a44319SMike Barcroft.Vt int8_t ,
45a2a44319SMike Barcroft.Vt int16_t ,
46a2a44319SMike Barcroft.Vt int32_t ,
47a2a44319SMike Barcroftand
48a2a44319SMike Barcroft.Vt int64_t
49a2a44319SMike Barcroftprovide a signed integer type of width 8, 16, 32, or 64 bits, respectively.
50a2a44319SMike BarcroftThe types
51a2a44319SMike Barcroft.Vt uint8_t ,
52a2a44319SMike Barcroft.Vt uint16_t ,
53a2a44319SMike Barcroft.Vt uint32_t ,
54a2a44319SMike Barcroftand
55a2a44319SMike Barcroft.Vt uint64_t
56a2a44319SMike Barcroftprovide an unsigned integer type of width 8, 16, 32, or 64 bits, respectively.
57a2a44319SMike BarcroftThese integer types should be used when a specific size is required.
58a2a44319SMike Barcroft.Pp
59a2a44319SMike BarcroftThe types
60a2a44319SMike Barcroft.Vt int_fast8_t ,
61a2a44319SMike Barcroft.Vt int_fast16_t ,
62a2a44319SMike Barcroft.Vt int_fast32_t ,
63a2a44319SMike Barcroftand
64a2a44319SMike Barcroft.Vt int_fast64_t
65a2a44319SMike Barcroftprovide the fastest signed integer type with a width
66a2a44319SMike Barcroftof at least 8, 16, 32, or 64 bits, respectively.
67a2a44319SMike BarcroftThe types
68a2a44319SMike Barcroft.Vt uint_fast8_t ,
69a2a44319SMike Barcroft.Vt uint_fast16_t ,
70a2a44319SMike Barcroft.Vt uint_fast32_t ,
71a2a44319SMike Barcroftand
72a2a44319SMike Barcroft.Vt uint_fast64_t
73a2a44319SMike Barcroftprovide the fastest unsigned integer type with a width
74a2a44319SMike Barcroftof at least 8, 16, 32, or 64 bits, respectively.
75a2a44319SMike BarcroftThese types should be used when access speed is
76a2a44319SMike Barcroftparamount, and when a specific size is not required.
77a2a44319SMike Barcroft.Pp
78a2a44319SMike BarcroftThe types
79a2a44319SMike Barcroft.Vt int_least8_t ,
80a2a44319SMike Barcroft.Vt int_least16_t ,
81a2a44319SMike Barcroft.Vt int_least32_t ,
82a2a44319SMike Barcroftand
83a2a44319SMike Barcroft.Vt int_least64_t
84a2a44319SMike Barcroftprovide the smallest memory footprint signed integer type with
85a2a44319SMike Barcrofta width of at least 8, 16, 32, or 64 bits, respectively.
86a2a44319SMike BarcroftThe types
87a2a44319SMike Barcroft.Vt uint_least8_t ,
88a2a44319SMike Barcroft.Vt uint_least16_t ,
89a2a44319SMike Barcroft.Vt uint_least32_t ,
90a2a44319SMike Barcroftand
91a2a44319SMike Barcroft.Vt uint_least64_t
92a2a44319SMike Barcroftprovide the smallest memory footprint unsigned integer type with
93a2a44319SMike Barcrofta width of at least 8, 16, 32, or 64 bits, respectively.
94a2a44319SMike BarcroftThese types should be used when memory storage is of
95a2a44319SMike Barcroftconcern, and when a specific size is not required.
96a2a44319SMike Barcroft.Pp
97a2a44319SMike BarcroftThe type
98a2a44319SMike Barcroft.Vt intmax_t
99a2a44319SMike Barcroftprovides a signed integer type large
100a2a44319SMike Barcroftenough to hold any other signed integer.
101a2a44319SMike BarcroftThe type
102a2a44319SMike Barcroft.Vt uintmax_t
103a2a44319SMike Barcroftprovides an unsigned integer type large
104a2a44319SMike Barcroftenough to hold any other unsigned integer.
105a2a44319SMike BarcroftThese types are generally the largest signed and unsigned
106a2a44319SMike Barcroftinteger types available on a specific architecture.
107beddcd8bSMike Barcroft.Pp
108beddcd8bSMike BarcroftThe type
109beddcd8bSMike Barcroft.Vt intptr_t
110beddcd8bSMike Barcroftprovides a signed integer type with the ability to hold a pointer to
111beddcd8bSMike Barcroft.Vt void ,
112beddcd8bSMike Barcroftthat can later be converted back to a pointer to
113beddcd8bSMike Barcroft.Vt void .
114beddcd8bSMike Barcroft.Pp
115beddcd8bSMike BarcroftThe type
116beddcd8bSMike Barcroft.Vt uintptr_t
117beddcd8bSMike Barcroftprovides an unsigned integer type with the ability to hold a pointer to
118beddcd8bSMike Barcroft.Vt void ,
119beddcd8bSMike Barcroftthat can later be converted back to a pointer to
120beddcd8bSMike Barcroft.Vt void .
121beddcd8bSMike Barcroft.Pp
122beddcd8bSMike BarcroftAdditionally, the
123fe08efe6SRuslan Ermilov.In stdint.h
124beddcd8bSMike Barcroftheader defines some macros, but none of them are documented here.
125a2a44319SMike Barcroft.Sh STANDARDS
126a2a44319SMike BarcroftThe
127fe08efe6SRuslan Ermilov.In stdint.h
128a2a44319SMike Barcroftheader conforms to
129a2a44319SMike Barcroft.St -isoC-99
130a2a44319SMike Barcroftand
131a2a44319SMike Barcroft.St -p1003.1-2001 .
132a2a44319SMike Barcroft.Sh HISTORY
133a2a44319SMike BarcroftThe
134fe08efe6SRuslan Ermilov.In stdint.h
135a2a44319SMike Barcroftheader was first introduced in
136a2a44319SMike Barcroft.Fx 5.0 .
137