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