summaryrefslogtreecommitdiffstats
path: root/man3type/intptr_t.3type
blob: b7e8ead84bfaf9f2f54a8781b8dd8130c523d428 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.\" Copyright (c) 2020-2022 by Alejandro Colomar <alx@kernel.org>
.\" and Copyright (c) 2020 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.\"
.TH intptr_t 3type 2022-10-30 "Linux man-pages 6.03"
.SH NAME
intptr_t, uintptr_t \- integer types wide enough to hold pointers
.SH LIBRARY
Standard C library
.RI ( libc )
.SH SYNOPSIS
.nf
.B #include <stdint.h>
.PP
.BR typedef " /* ... */ " intptr_t;
.BR typedef " /* ... */ " uintptr_t;
.PP
.BR "#define INTPTR_WIDTH" "  /* ... */"
.B #define UINTPTR_WIDTH INTPTR_WIDTH
.PP
.BR "#define INTPTR_MAX" "    /*  2**(INTPTR_WIDTH \- 1) \- 1  */"
.BR "#define INTPTR_MIN" "    /*  \- 2**(INTPTR_WIDTH \- 1)    */"
.BR "#define UINTPTR_MAX" "   /*  2**UINTPTR_WIDTH \- 1       */"
.fi
.SH DESCRIPTION
.I intptr_t
is a signed integer type
such that any valid
.RI ( "void *" )
value can be converted to this type and then converted back.
It is capable of storing values in the range
.RB [ INTPTR_MIN ,
.BR INTPTR_MAX ].
.PP
.I uintptr_t
is an unsigned integer type
such that any valid
.RI ( "void *" )
value can be converted to this type and then converted back.
It is capable of storing values in the range
.RB [ 0 ,
.BR INTPTR_MAX ].
.PP
The macros
.RB [ U ] INTPTR_WIDTH
expand to the width in bits of these types.
.PP
The macros
.RB [ U ] INTPTR_MAX
expand to the maximum value that these types can hold.
.PP
The macro
.B INTPTR_MIN
expands to the minimum value that
.I intptr_t
can hold.
.PP
The length modifiers for the
.RI [ u ] intptr_t
types
for the
.BR printf (3)
family of functions
are expanded by the macros
.BR PRIdPTR ,
.BR PRIiPTR ,
and
.B PRIuPTR
(defined in
.IR <inttypes.h> );
resulting commonly in
.B %"PRIdPTR"
or
.B %"PRIiPTR"
for printing
.I intptr_t
values.
The length modifiers for the
.IR [ u ] intptr_t
types
for the
.BR scanf (3)
family of functions
are expanded by the macros
.BR SCNdPTR ,
.BR SCNiPTR ,
and
.B SCNuPTR
(defined in
.IR <inttypes.h> );
resulting commonly in
.B %"SCNuPTR"
for scanning
.I uintptr_t
values.
.SH STANDARDS
C99 and later; POSIX.1-2001 and later.
.SH NOTES
The following header also provides these types:
.IR <inttypes.h> .
.SH SEE ALSO
.BR intmax_t (3type),
.BR void (3)