1@node stdint.h
2@section @file{stdint.h}
3
4POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html}
5
6Gnulib module: stdint
7
8Portability problems fixed by Gnulib:
9@itemize
10@item
11This header file is missing on some platforms:
12OpenBSD 3.8, AIX 5.1, HP-UX 11.11, IRIX 6.5, MSVC 14.
13@item
14This header file is very incomplete on some platforms.
15@item
16The values of @code{SIG_ATOMIC_MIN} and @code{SIG_ATOMIC_MAX} are incorrect
17on some platforms:
18FreeBSD 6.2/ia64, FreeBSD 13.0/arm64.
19@item
20The value of @code{WINT_MAX} is incorrect on some platforms:
21mingw.
22@item
23The values of @code{INT8_MAX}, @code{UINT8_MAX} etc. are not usable in
24preprocessor expressions on some platforms:
25HP-UX 11.23.
26@item
27The values of @code{INTPTR_MAX} and @code{UINTPTR_MAX}, although correctly
28defined in @code{<stdint.h>}, are replaced by empty values when
29@code{<limits.h>} or @code{<inttypes.h>} gets included later on some platforms:
30Solaris 9 with GCC 4.5 or newer.
31@item
32The macros @code{WCHAR_MIN} and @code{WCHAR_MAX} are not defined in
33@code{<stdint.h>} (only in @code{<wchar.h>}) on some platforms:
34Dragonfly.
35@item
36On some hosts that predate C++11, when using C++ one must define
37@code{__STDC_CONSTANT_MACROS} to make visible the definitions of
38constant macros such as @code{INTMAX_C}, and one must define
39@code{__STDC_LIMIT_MACROS} to make visible the definitions of limit
40macros such as @code{INTMAX_MAX}.
41@item
42The macro @code{SIZE_MAX} has the wrong type,
43albeit with the correct value:
4432-bit glibc 2.24 (on s390 architecture), Mac OS X 10.7.
45@item
46Macros like @code{INTMAX_WIDTH} are not defined on some platforms:
47glibc 2.24, NetBSD 9.0, many others.
48@end itemize
49
50Portability problems not fixed by Gnulib:
51@itemize
52@item
53@code{@{uint,int@}_fast@{8,16,32,64@}_t} may not correspond to the fastest
54types available on the system.
55Other @code{<stdint.h>} substitutes may define these types differently,
56so public header files should avoid these types.
57@item
58Macros are used instead of typedefs.
59@item
60Some C preprocessors mishandle constants that do not fit in @code{long int}.
61For example, as of 2007, Sun C mishandled @code{#if LLONG_MIN < 0} on
62a platform with 32-bit @code{long int} and 64-bit @code{long long int};
63this bug was fixed on or before Oracle Developer Studio 12.6
64(Sun C 5.15 SunOS_sparc 2017/05/30).
65Some older preprocessors mishandle constants ending in @code{LL}.
66To work around these problems, compute the value of expressions like
67@code{LONG_MAX < LLONG_MAX} at @code{configure}-time rather than at
68@code{#if}-time.
69@end itemize
70
71The @code{stdint} module uses @code{#include_next}.  If you wish to install
72the generated stdint.h file under another name, typically in order to
73be able to use some of the types defined by stdint.h in your public
74header file, you could use the following Makefile.am-snippet:
75
76@example
77
78BUILT_SOURCES += idn-int.h
79DISTCLEANFILES += idn-int.h
80nodist_include_HEADERS += idn-int.h
81
82idn-int.h:
83	if test -n "$(STDINT_H)"; then \
84		sed -e s/include_next/include/ gl/stdint.h > idn-int.h; \
85	else \
86		echo '#include <stdint.h>' > idn-int.h; \
87	fi
88@end example
89