2 @subsection @code{vsprintf}
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/vsprintf.html}
7 Gnulib module: vsprintf-posix or vsprintf-gnu
9 Portability problems fixed by either Gnulib module @code{vsprintf-posix} or @code{vsprintf-gnu}:
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, Solaris 9, Cygwin 1.5.24, old mingw, MSVC 9.
16 This function does not support size specifiers as in C23 (@code{w8},
17 @code{w16}, @code{w32}, @code{w64}, @code{wf8}, @code{wf16}, @code{wf32},
18 @code{wf64}) on some platforms:
19 glibc 2.37, musl libc, macOS 14, FreeBSD 13.2, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC, Android 9.0.
21 printf of @samp{long double} numbers is unsupported on some platforms:
24 printf @code{"%f"}, @code{"%e"}, @code{"%g"} of Infinity and NaN yields an
25 incorrect result on some platforms:
26 AIX 7.3, Solaris 11.4, mingw, MSVC 14.
28 This function does not support the @samp{a} and @samp{A} directives on some
30 FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11,
31 Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
33 This function does not support the @samp{b} directive, required by ISO C23,
35 glibc 2.34, musl libc, macOS 14, FreeBSD 13.2, NetBSD 10.0, OpenBSD 7.5,
36 AIX 7.3, HP-UX 11, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 14, Android 9.0.
38 This function does not support the @samp{F} directive on some platforms:
39 NetBSD 3.0, AIX 5.1, HP-UX 11.23, Solaris 9,
40 Cygwin 1.5.x, mingw, MSVC 14.
42 This function does not support the @samp{ls} directive on some platforms:
43 OpenBSD 4.0, Cygwin 1.5.x, Haiku.
45 This function does not support precisions in the @samp{ls} directive correctly
49 This function does not support format directives that access arguments in an
50 arbitrary order, such as @code{"%2$s"}, on some platforms:
51 NetBSD 3.0, mingw, MSVC 14.
53 This function doesn't support the @code{'} flag on some platforms:
54 NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14.
56 This function does not round the argument of the @samp{a} directive correctly
58 macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4.
60 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
61 with zeroes, or wrong capitalization) on some platforms:
62 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 7.3, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
64 printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
65 incorrect result (non-empty) on some platforms:
68 This function does not support precisions larger than 512 or 1024 in integer,
69 floating-point and pointer output on some platforms:
70 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
72 This function mishandles large floating point precisions
73 (for example, formatting 1.0 with @samp{"%.511f"})
77 This function produces wrong output for the @samp{lc} directive with a NUL
78 wide character argument on some platforms:
81 This function can crash in out-of-memory conditions on some platforms:
82 FreeBSD 14.0, NetBSD 5.0.
84 The compiler warns that this function is deprecated:
88 Portability problems fixed by Gnulib module @code{vsprintf-gnu}:
91 This function does not support the @samp{B} directive on some platforms:
92 glibc 2.34, musl libc, macOS 14, FreeBSD 13.2, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC, Android 9.0.
95 Portability problems fixed by either Gnulib module @code{vsprintf-posix} or @code{vsprintf-gnu}
96 and additionally the Gnulib module @code{printf-with-n-directive}:
99 This function does not support the @samp{n} directive on some platforms:
100 glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
101 macOS 14, OpenBSD, MSVC 14, Android.
104 Portability problems not fixed by Gnulib:
107 The @code{%m} directive is not portable, use @code{%s} mapped to an
108 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
111 Formatting noncanonical @samp{long double} numbers produces
112 nonmeaningful results on some platforms:
113 glibc and others, on x86, x86_64, IA-64 CPUs.
115 When formatting an integer with grouping flag, this function inserts thousands
116 separators even in the "C" locale on some platforms: