poll tests: Avoid test failure on BSD and Solaris systems.
[gnulib.git] / doc / posix-functions / printf.texi
blob0b5e2b97e64991a83e05a09f9186762032b27813
1 @node printf
2 @section @code{printf}
3 @findex printf
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html}
7 Gnulib module: printf-posix or stdio, nonblocking, sigpipe
9 Portability problems fixed by Gnulib module @code{printf-posix}:
10 @itemize
11 @item
12 This function does not support size specifiers as in C99 (@code{hh}, @code{ll},
13 @code{j}, @code{t}, @code{z}) on some platforms:
14 AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9, Cygwin 1.5.24, mingw, MSVC 14.
15 @item
16 printf of @samp{long double} numbers is unsupported on some platforms:
17 mingw, MSVC 14.
18 @item
19 printf @code{"%f"}, @code{"%e"}, @code{"%g"} of Infinity and NaN yields an
20 incorrect result on some platforms:
21 AIX 5.2, Solaris 11.4, mingw, MSVC 14.
22 @item
23 This function does not support the @samp{a} and @samp{A} directives on some
24 platforms:
25 glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
26 IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
27 @item
28 This function does not support the @samp{F} directive on some platforms:
29 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
30 Cygwin 1.5.x, mingw, MSVC 14.
31 @item
32 This function does not support the @samp{n} directive on some platforms:
33 glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
34 Mac OS X 10.13, MSVC 14.
35 @item
36 This function does not support the @samp{ls} directive on some platforms:
37 OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
38 @item
39 This function does not support precisions in the @samp{ls} directive correctly
40 on some platforms:
41 Solaris 11.4.
42 @item
43 This function does not support format directives that access arguments in an
44 arbitrary order, such as @code{"%2$s"}, on some platforms:
45 NetBSD 3.0, mingw, MSVC 14.
46 @item
47 This function doesn't support the @code{'} flag on some platforms:
48 NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14.
49 @item
50 This function does not round the argument of the @samp{a} directive correctly
51 on some platforms:
52 Mac OS X 10.12, FreeBSD 6.1.
53 @item
54 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
55 with zeroes, or wrong capitalization) on some platforms:
56 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
57 @item
58 This function does not support precisions larger than 512 or 1024 in integer,
59 floating-point and pointer output on some platforms:
60 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
61 @item
62 This function mishandles large floating point precisions
63 (for example, formatting 1.0 with @samp{"%.511f"})
64 on some platforms:
65 Solaris 10.
66 @item
67 This function can crash in out-of-memory conditions on some platforms:
68 FreeBSD 6.0, NetBSD 5.0.
69 @end itemize
71 Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{nonblocking}:
72 @itemize
73 @item
74 When writing to a non-blocking pipe whose buffer is full, this function fails
75 with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
76 platforms:
77 mingw, MSVC 14.
78 @end itemize
80 Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{sigpipe}:
81 @itemize
82 @item
83 When writing to a pipe with no readers, this function fails, instead of
84 obeying the current @code{SIGPIPE} handler, on some platforms:
85 mingw, MSVC 14.
86 @end itemize
88 Portability problems not fixed by Gnulib:
89 @itemize
90 @item
91 The @code{%m} directive is not portable, use @code{%s} mapped to an
92 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
93 instead.
94 @item
95 Formatting noncanonical @samp{long double} numbers produces
96 nonmeaningful results on some platforms:
97 glibc and others, on x86, x86_64, IA-64 CPUs.
98 @item
99 When formatting an integer with grouping flag, this function inserts thousands
100 separators even in the "C" locale on some platforms:
101 NetBSD 5.1.
102 @item
103 Attempting to write to a read-only stream fails with @code{EOF} but
104 does not set the error flag for @code{ferror} on some platforms:
105 glibc 2.13, cygwin 1.7.9.
106 @end itemize