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