| 1 |
.\" Copyright 2020, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH intptr_t 3type 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
intptr_t, uintptr_t \- integer types wide enough to hold pointers |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.B #include <stdint.h> |
| 15 |
.P |
| 16 |
.BR typedef " /* ... */ " intptr_t; |
| 17 |
.BR typedef " /* ... */ " uintptr_t; |
| 18 |
.P |
| 19 |
.BR "#define INTPTR_WIDTH" " /* ... */" |
| 20 |
.B #define UINTPTR_WIDTH INTPTR_WIDTH |
| 21 |
.P |
| 22 |
.BR "#define INTPTR_MAX" " /* 2**(INTPTR_WIDTH \- 1) \- 1 */" |
| 23 |
.BR "#define INTPTR_MIN" " /* \- 2**(INTPTR_WIDTH \- 1) */" |
| 24 |
.BR "#define UINTPTR_MAX" " /* 2**UINTPTR_WIDTH \- 1 */" |
| 25 |
.fi |
| 26 |
.SH DESCRIPTION |
| 27 |
.I intptr_t |
| 28 |
is a signed integer type |
| 29 |
such that any valid |
| 30 |
.RI ( "void *" ) |
| 31 |
value can be converted to this type and then converted back. |
| 32 |
It is capable of storing values in the range |
| 33 |
.RB [ INTPTR_MIN , |
| 34 |
.BR INTPTR_MAX ]. |
| 35 |
.P |
| 36 |
.I uintptr_t |
| 37 |
is an unsigned integer type |
| 38 |
such that any valid |
| 39 |
.RI ( "void *" ) |
| 40 |
value can be converted to this type and then converted back. |
| 41 |
It is capable of storing values in the range |
| 42 |
.RB [ 0 , |
| 43 |
.BR UINTPTR_MAX ]. |
| 44 |
.P |
| 45 |
The macros |
| 46 |
.RB [ U ] INTPTR_WIDTH |
| 47 |
expand to the width in bits of these types. |
| 48 |
.P |
| 49 |
The macros |
| 50 |
.RB [ U ] INTPTR_MAX |
| 51 |
expand to the maximum value that these types can hold. |
| 52 |
.P |
| 53 |
The macro |
| 54 |
.B INTPTR_MIN |
| 55 |
expands to the minimum value that |
| 56 |
.I intptr_t |
| 57 |
can hold. |
| 58 |
.P |
| 59 |
The length modifiers for the |
| 60 |
.RI [ u ] intptr_t |
| 61 |
types |
| 62 |
for the |
| 63 |
.BR printf (3) |
| 64 |
family of functions |
| 65 |
are expanded by the macros |
| 66 |
.BR PRIdPTR , |
| 67 |
.BR PRIiPTR , |
| 68 |
and |
| 69 |
.B PRIuPTR |
| 70 |
(defined in |
| 71 |
.IR <inttypes.h> ); |
| 72 |
resulting commonly in |
| 73 |
.B %"PRIdPTR" |
| 74 |
or |
| 75 |
.B %"PRIiPTR" |
| 76 |
for printing |
| 77 |
.I intptr_t |
| 78 |
values. |
| 79 |
The length modifiers for the |
| 80 |
.RI [ u ] intptr_t |
| 81 |
types |
| 82 |
for the |
| 83 |
.BR scanf (3) |
| 84 |
family of functions |
| 85 |
are expanded by the macros |
| 86 |
.BR SCNdPTR , |
| 87 |
.BR SCNiPTR , |
| 88 |
and |
| 89 |
.B SCNuPTR |
| 90 |
(defined in |
| 91 |
.IR <inttypes.h> ); |
| 92 |
resulting commonly in |
| 93 |
.B %"SCNuPTR" |
| 94 |
for scanning |
| 95 |
.I uintptr_t |
| 96 |
values. |
| 97 |
.SH STANDARDS |
| 98 |
.TP |
| 99 |
.RI [ u ] intptr_t |
| 100 |
.TQ |
| 101 |
.RB [ U ] INTPTR_MAX |
| 102 |
.TQ |
| 103 |
.B INTPTR_MIN |
| 104 |
C23, POSIX.1-2024. |
| 105 |
.TP |
| 106 |
.RB [ U ] INTPTR_WIDTH |
| 107 |
C23. |
| 108 |
.SH HISTORY |
| 109 |
.TP |
| 110 |
.RI [ u ] intptr_t |
| 111 |
SUSv2, |
| 112 |
C99, |
| 113 |
POSIX.1-2001 XSI. |
| 114 |
.TP |
| 115 |
.RB [ U ] INTPTR_MAX |
| 116 |
.TQ |
| 117 |
.B INTPTR_MIN |
| 118 |
C99, |
| 119 |
POSIX.1-2001 XSI. |
| 120 |
.TP |
| 121 |
.RB [ U ] INTPTR_WIDTH |
| 122 |
C23. |
| 123 |
.SH NOTES |
| 124 |
The following header also provides these types: |
| 125 |
.IR <inttypes.h> . |
| 126 |
.SH SEE ALSO |
| 127 |
.BR intmax_t (3type), |
| 128 |
.BR void (3) |