2 @section @code{sprintf}
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/sprintf.html}
7 Gnulib module: sprintf-posix
9 Portability problems fixed by Gnulib:
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.
16 printf of @samp{long double} numbers is unsupported on some platforms:
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.
23 This function does not support the @samp{a} and @samp{A} directives on some
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.
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.
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.
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.
39 This function does not support precisions in the @samp{ls} directive correctly
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.
47 This function doesn't support the @code{'} flag on some platforms:
48 NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14.
50 This function does not round the argument of the @samp{a} directive correctly
52 Mac OS X 10.12, FreeBSD 6.1.
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.
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.
62 This function mishandles large floating point precisions
63 (for example, formatting 1.0 with @samp{"%.511f"})
67 This function can crash in out-of-memory conditions on some platforms:
68 FreeBSD 6.0, NetBSD 5.0.
71 Portability problems not fixed by Gnulib:
74 The @code{%m} directive is not portable, use @code{%s} mapped to an
75 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
78 Formatting noncanonical @samp{long double} numbers produces
79 nonmeaningful results on some platforms:
80 glibc and others, on x86, x86_64, IA-64 CPUs.
82 When formatting an integer with grouping flag, this function inserts thousands
83 separators even in the "C" locale on some platforms: