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