stdint: document issues with int_fast8_t etc.
[gnulib.git] / doc / posix-headers / stdint.texi
1 @node stdint.h
2 @section @file{stdint.h}
3
4 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html}
5
6 Gnulib module: stdint
7
8 Portability problems fixed by Gnulib:
9 @itemize
10 @item
11 This header file is missing on some platforms:
12 OpenBSD 3.8, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, MSVC 9, Interix 3.5, BeOS.
13 @item
14 This header file is very incomplete on some platforms.
15 @item
16 The values of @code{SIG_ATOMIC_MIN} and @code{SIG_ATOMIC_MAX} are incorrect
17 on some platforms:
18 FreeBSD 6.2 / ia64.
19 @item
20 The value of @code{WINT_MAX} is incorrect on some platforms:
21 mingw.
22 @item
23 The values of @code{INT8_MAX}, @code{UINT8_MAX} etc. are not usable in
24 preprocessor expressions on some platforms:
25 HP-UX 11.23.
26 @item
27 The macros @code{WCHAR_MIN} and @code{WCHAR_MAX} are not defined in
28 @code{<stdint.h>} (only in @code{<wchar.h>}) on some platforms:
29 Dragonfly, BSDI.
30 @item
31 On some hosts that predate C++11, when using C++ one must define
32 @code{__STDC_CONSTANT_MACROS} to make visible the definitions of
33 constant macros such as @code{INTMAX_C}, and one must define
34 @code{__STDC_LIMIT_MACROS} to make visible the definitions of limit
35 macros such as @code{INTMAX_MAX}.
36 @end itemize
37
38 Portability problems not fixed by Gnulib:
39 @itemize
40 @item
41 @code{@{uint,int@}_fast@{8,16,32,64@}_t} may not correspond to the fastest
42 types available on the system.
43 Other @code{<stdint.h>} substitutes may define these types differently,
44 so public header files should avoid these types.
45 @item
46 Macros are used instead of typedefs.
47 @item
48 Some C preprocessors mishandle constants that do not fit in @code{long int}.
49 For example, as of 2007, Sun C mishandles @code{#if LLONG_MIN < 0} on
50 a platform with 32-bit @code{long int} and 64-bit @code{long long int}.
51 Some older preprocessors mishandle constants ending in @code{LL}.
52 To work around these problems, compute the value of expressions like
53 @code{LONG_MAX < LLONG_MAX} at @code{configure}-time rather than at
54 @code{#if}-time.
55 @end itemize
56
57 The stdint.h module uses @code{#include_next}.  If you wish to install
58 the generated stdint.h file under another name, typically in order to
59 be able to use some of the types defined by stdint.h in your public
60 header file, you could use the following Makefile.am-snippet:
61
62 @example
63
64 BUILT_SOURCES += idn-int.h
65 DISTCLEANFILES += idn-int.h
66 nodist_include_HEADERS += idn-int.h
67
68 idn-int.h:
69         if test -n "$(STDINT_H)"; then \
70                 sed -e s/include_next/include/ gl/stdint.h > idn-int.h; \
71         else \
72                 echo '#include <stdint.h>' > idn-int.h; \
73         fi
74 @end example