xref: /freebsd/share/man/man7/stdint.7 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.\"
25beddcd8bSMike Barcroft.Dd September 15, 2002
26a2a44319SMike Barcroft.Dt STDINT 7
27a2a44319SMike Barcroft.Os
28a2a44319SMike Barcroft.Sh NAME
29a2a44319SMike Barcroft.Nm stdint
30beddcd8bSMike Barcroft.Nd "standard integer types"
31a2a44319SMike Barcroft.Sh SYNOPSIS
32a2a44319SMike Barcroft.In stdint.h
33a2a44319SMike Barcroft.Sh DESCRIPTION
34a2a44319SMike BarcroftThe
35fe08efe6SRuslan Ermilov.In stdint.h
36a2a44319SMike Barcroftheader provides source-portable integer types of a specific
37a2a44319SMike Barcroftsize, smallest memory footprint with a minimum size, fastest
38beddcd8bSMike Barcroftaccess speed with a minimum size, largest integer size, and
39beddcd8bSMike Barcroftthose capable of storing pointers.
40a2a44319SMike Barcroft.Pp
41a2a44319SMike BarcroftThe types
42a2a44319SMike Barcroft.Vt int8_t ,
43a2a44319SMike Barcroft.Vt int16_t ,
44a2a44319SMike Barcroft.Vt int32_t ,
45a2a44319SMike Barcroftand
46a2a44319SMike Barcroft.Vt int64_t
47a2a44319SMike Barcroftprovide a signed integer type of width 8, 16, 32, or 64 bits, respectively.
48a2a44319SMike BarcroftThe types
49a2a44319SMike Barcroft.Vt uint8_t ,
50a2a44319SMike Barcroft.Vt uint16_t ,
51a2a44319SMike Barcroft.Vt uint32_t ,
52a2a44319SMike Barcroftand
53a2a44319SMike Barcroft.Vt uint64_t
54a2a44319SMike Barcroftprovide an unsigned integer type of width 8, 16, 32, or 64 bits, respectively.
55a2a44319SMike BarcroftThese integer types should be used when a specific size is required.
56a2a44319SMike Barcroft.Pp
57a2a44319SMike BarcroftThe types
58a2a44319SMike Barcroft.Vt int_fast8_t ,
59a2a44319SMike Barcroft.Vt int_fast16_t ,
60a2a44319SMike Barcroft.Vt int_fast32_t ,
61a2a44319SMike Barcroftand
62a2a44319SMike Barcroft.Vt int_fast64_t
63a2a44319SMike Barcroftprovide the fastest signed integer type with a width
64a2a44319SMike Barcroftof at least 8, 16, 32, or 64 bits, respectively.
65a2a44319SMike BarcroftThe types
66a2a44319SMike Barcroft.Vt uint_fast8_t ,
67a2a44319SMike Barcroft.Vt uint_fast16_t ,
68a2a44319SMike Barcroft.Vt uint_fast32_t ,
69a2a44319SMike Barcroftand
70a2a44319SMike Barcroft.Vt uint_fast64_t
71a2a44319SMike Barcroftprovide the fastest unsigned integer type with a width
72a2a44319SMike Barcroftof at least 8, 16, 32, or 64 bits, respectively.
73a2a44319SMike BarcroftThese types should be used when access speed is
74a2a44319SMike Barcroftparamount, and when a specific size is not required.
75a2a44319SMike Barcroft.Pp
76a2a44319SMike BarcroftThe types
77a2a44319SMike Barcroft.Vt int_least8_t ,
78a2a44319SMike Barcroft.Vt int_least16_t ,
79a2a44319SMike Barcroft.Vt int_least32_t ,
80a2a44319SMike Barcroftand
81a2a44319SMike Barcroft.Vt int_least64_t
82a2a44319SMike Barcroftprovide the smallest memory footprint signed integer type with
83a2a44319SMike Barcrofta width of at least 8, 16, 32, or 64 bits, respectively.
84a2a44319SMike BarcroftThe types
85a2a44319SMike Barcroft.Vt uint_least8_t ,
86a2a44319SMike Barcroft.Vt uint_least16_t ,
87a2a44319SMike Barcroft.Vt uint_least32_t ,
88a2a44319SMike Barcroftand
89a2a44319SMike Barcroft.Vt uint_least64_t
90a2a44319SMike Barcroftprovide the smallest memory footprint unsigned integer type with
91a2a44319SMike Barcrofta width of at least 8, 16, 32, or 64 bits, respectively.
92a2a44319SMike BarcroftThese types should be used when memory storage is of
93a2a44319SMike Barcroftconcern, and when a specific size is not required.
94a2a44319SMike Barcroft.Pp
95a2a44319SMike BarcroftThe type
96a2a44319SMike Barcroft.Vt intmax_t
97a2a44319SMike Barcroftprovides a signed integer type large
98a2a44319SMike Barcroftenough to hold any other signed integer.
99a2a44319SMike BarcroftThe type
100a2a44319SMike Barcroft.Vt uintmax_t
101a2a44319SMike Barcroftprovides an unsigned integer type large
102a2a44319SMike Barcroftenough to hold any other unsigned integer.
103a2a44319SMike BarcroftThese types are generally the largest signed and unsigned
104a2a44319SMike Barcroftinteger types available on a specific architecture.
105beddcd8bSMike Barcroft.Pp
106beddcd8bSMike BarcroftThe type
107beddcd8bSMike Barcroft.Vt intptr_t
108beddcd8bSMike Barcroftprovides a signed integer type with the ability to hold a pointer to
109beddcd8bSMike Barcroft.Vt void ,
110beddcd8bSMike Barcroftthat can later be converted back to a pointer to
111beddcd8bSMike Barcroft.Vt void .
112beddcd8bSMike Barcroft.Pp
113beddcd8bSMike BarcroftThe type
114beddcd8bSMike Barcroft.Vt uintptr_t
115beddcd8bSMike Barcroftprovides an unsigned integer type with the ability to hold a pointer to
116beddcd8bSMike Barcroft.Vt void ,
117beddcd8bSMike Barcroftthat can later be converted back to a pointer to
118beddcd8bSMike Barcroft.Vt void .
119beddcd8bSMike Barcroft.Pp
120beddcd8bSMike BarcroftAdditionally, the
121fe08efe6SRuslan Ermilov.In stdint.h
122beddcd8bSMike Barcroftheader defines some macros, but none of them are documented here.
123a2a44319SMike Barcroft.Sh STANDARDS
124a2a44319SMike BarcroftThe
125fe08efe6SRuslan Ermilov.In stdint.h
126a2a44319SMike Barcroftheader conforms to
127a2a44319SMike Barcroft.St -isoC-99
128a2a44319SMike Barcroftand
129a2a44319SMike Barcroft.St -p1003.1-2001 .
130a2a44319SMike Barcroft.Sh HISTORY
131a2a44319SMike BarcroftThe
132fe08efe6SRuslan Ermilov.In stdint.h
133a2a44319SMike Barcroftheader was first introduced in
134a2a44319SMike Barcroft.Fx 5.0 .
135