c6e4a003979d9e9ac6f4d296a08fb1b708bf4564
[gnulib.git] / doc / posix-functions / snprintf.texi
1 @node snprintf
2 @section @code{snprintf}
3 @findex snprintf
4
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/snprintf.html}
6
7 Gnulib module: snprintf or snprintf-posix
8
9 Portability problems fixed by either Gnulib module @code{snprintf} or @code{snprintf-posix}:
10 @itemize
11 @item
12 This function is missing on some platforms:
13 IRIX 5.3, OSF/1 4.0, Solaris 2.5.1, MSVC 9.
14 @item
15 This function does not support format directives that access arguments in an
16 arbitrary order, such as @code{"%2$s"}, on some platforms:
17 NetBSD 3.0, mingw, BeOS.
18 @item
19 This function does not return a byte count as specified in C99 on some
20 platforms:
21 HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
22 @item
23 This function overwrites memory even when a size argument of 1 is passed on some
24 platforms:
25 Linux libc5, BeOS.
26 @end itemize
27
28 Portability problems fixed by Gnulib module @code{snprintf-posix}:
29 @itemize
30 @item
31 This function does not support size specifiers as in C99 (@code{hh}, @code{ll},
32 @code{j}, @code{t}, @code{z}) on some platforms:
33 AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.24, mingw, MSVC 9, BeOS.
34 @item
35 printf of @samp{long double} numbers is unsupported on some platforms:
36 mingw, MSVC 9, BeOS.
37 @item
38 printf @code{"%f"}, @code{"%e"}, @code{"%g"} of Infinity and NaN yields an
39 incorrect result on some platforms:
40 AIX 5.2, OSF/1 5.1, Solaris 11 2011-11, mingw, MSVC 9.
41 @item
42 This function does not support the @samp{a} and @samp{A} directives on some
43 platforms:
44 glibc-2.3.6, MacOS X 10.5, NetBSD 5.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
45 IRIX 6.5, OSF/1 5.1, Solaris 11 2011-11, Cygwin 1.5.x, mingw, MSVC 9, BeOS.
46 @item
47 This function does not support the @samp{F} directive on some platforms:
48 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
49 Cygwin 1.5.x, mingw, MSVC 9, BeOS.
50 @item
51 This function does not support the @samp{n} directive on some platforms:
52 MSVC 9.
53 @item
54 This function does not support the @samp{ls} directive on some platforms:
55 OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku.
56 @item
57 This function does not support precisions in the @samp{ls} directive correctly
58 on some platforms:
59 Solaris 11 2011-11.
60 @item
61 This function doesn't support the @code{'} flag on some platforms:
62 NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
63 @item
64 This function behaves incorrectly when a @samp{-} flag and a negative width
65 are specified together, on some platforms:
66 HP-UX 10.20.
67 @item
68 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
69 with zeroes) on some platforms:
70 MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 11 2011-11, Cygwin 1.5.x, mingw, MSVC 9.
71 @item
72 This function does not support precisions larger than 512 or 1024 in integer,
73 floating-point and pointer output on some platforms:
74 AIX 7.1, Solaris 10/x86, mingw, MSVC 9, BeOS.
75 @item
76 This function mishandles large floating point precisions
77 (for example, formatting 1.0 with @samp{"%.511f"})
78 on some platforms:
79 Solaris 10.
80 @item
81 This function can crash in out-of-memory conditions on some platforms:
82 MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
83 @item
84 This function does not truncate the result as specified in C99 on some platforms:
85 mingw, MSVC 9.
86 @item
87 This function does not fully support the @samp{n} directive on some platforms:
88 HP-UX 11, mingw, MSVC 9.
89 @item
90 This function overwrites memory even when a zero size argument is passed on some
91 platforms:
92 OSF/1 5.1.
93 @end itemize
94
95 Portability problems not fixed by Gnulib:
96 @itemize
97 @item
98 When formatting an integer with grouping flag, this function inserts thousands
99 separators even in the "C" locale on some platforms:
100 NetBSD 5.1.
101 @end itemize