+2025-04-12 Bruno Haible <bruno@clisp.org>
+
+ vasnprintf: Work around two grouping bugs on native Windows.
+ * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_FLAG_GROUPING): On native
+ Windows, define NEED_PRINTF_FLAG_GROUPING.
+ * lib/vasnprintf.c (localeconv): Undefine.
+ (thousands_separator_char, thousands_separator_wchar): On native
+ Windows, use localeconv().
+ * tests/test-vasnprintf-posix2.c (main): On native Windows, expect
+ 3 digits for the exponent.
+ * tests/test-vasnwprintf-posix2.c (main): Likewise.
+ * doc/posix-functions/fprintf.texi: Mention the mingw and MSVC bugs.
+ * doc/posix-functions/vfprintf.texi: Likewise.
+ * doc/posix-functions/printf.texi: Likewise.
+ * doc/posix-functions/vprintf.texi: Likewise.
+ * doc/posix-functions/sprintf.texi: Likewise.
+ * doc/posix-functions/vsprintf.texi: Likewise.
+ * doc/posix-functions/snprintf.texi: Likewise.
+ * doc/posix-functions/vsnprintf.texi: Likewise.
+ * doc/posix-functions/dprintf.texi: Likewise.
+ * doc/posix-functions/vdprintf.texi: Likewise.
+ * doc/posix-functions/fwprintf.texi: Likewise.
+ * doc/posix-functions/vfwprintf.texi: Likewise.
+ * doc/posix-functions/wprintf.texi: Likewise.
+ * doc/posix-functions/vwprintf.texi: Likewise.
+ * doc/posix-functions/swprintf.texi: Likewise.
+ * doc/posix-functions/vswprintf.texi: Likewise.
+ * doc/posix-functions/asprintf.texi: Likewise.
+ * doc/posix-functions/vasprintf.texi: Likewise.
+ * doc/glibc-functions/obstack_printf.texi: Likewise.
+ * doc/glibc-functions/obstack_vprintf.texi: Likewise.
+
2025-04-12 Bruno Haible <bruno@clisp.org>
localeconv tests: Add multithread-safety test.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
arbitrary order, such as @code{"%2$s"}, on some platforms:
NetBSD 3.0.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24.
@item
incorrect result on some platforms:
AIX 7.3, Solaris 11.4.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
arbitrary order, such as @code{"%2$s"}, on some platforms:
NetBSD 3.0, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14.
@item
@code{wf64}) on some platforms:
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.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
musl libc 1.2.3,
macOS 14, FreeBSD 13.1, NetBSD 10.0, OpenBSD 7.2, AIX 7.2, mingw.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
@code{wf64}) on some platforms:
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.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
incorrect result on some platforms:
AIX 7.3, Solaris 11.4, mingw, MSVC 14.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
@code{wf64}) on some platforms:
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.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
@code{wf64}) on some platforms:
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.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
@code{wf64}) on some platforms:
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.
@item
+This function doesn't support the @code{'} flag at all on some platforms:
+mingw without @code{__USE_MINGW_ANSI_STDIO}, MSVC 14.
+@item
+This function doesn't support the @code{'} flag correctly for integers
+(it uses the decimal point instead of the thousands separator!)
+on some platforms:
+mingw with @code{__USE_MINGW_ANSI_STDIO}.
+@item
This function doesn't support the @code{'} flag together with a precision
on an integer argument correctly on some platforms:
glibc 2.36, FreeBSD 14.0, NetBSD 10.0, Solaris 11, Cygwin 3.6.0, Haiku.
# define IF_LINT(Code) /* empty */
#endif
+/* Here we need only the most basic fields of 'struct lconv', and can
+ therefore use the system's localeconv() function, without needing a
+ dependency on module 'localeconv'. */
+#undef localeconv
+
/* Avoid some warnings from "gcc -Wshadow".
This file doesn't use the exp() and remainder() functions. */
#undef exp
static const char *
thousands_separator_char (char stackbuf[10])
{
- /* Determine it in a multithread-safe way. We know nl_langinfo is
- multithread-safe on glibc systems, on Mac OS X systems, and on NetBSD,
- but is not required to be multithread-safe by POSIX. sprintf(), however,
- is multithread-safe. localeconv() is rarely multithread-safe. */
+ /* Determine it in a multithread-safe way.
+ We know nl_langinfo is multithread-safe on glibc systems, on Mac OS X
+ systems, and on NetBSD, but is not required to be multithread-safe by
+ POSIX.
+ localeconv() is not guaranteed to be multithread-safe by POSIX either;
+ however, on native Windows it is (cf. test-localeconv-mt).
+ sprintf(), however, is multithread-safe. */
# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __NetBSD__)
return nl_langinfo (THOUSEP);
-# elif 1
+# elif defined _WIN32 && !defined __CYGWIN__
+ return localeconv () -> thousands_sep;
+# else
sprintf (stackbuf, "%'.0f", 1000.0);
/* Now stackbuf = "1<thousep>000". */
stackbuf[strlen (stackbuf) - 3] = '\0';
strcpy (&stackbuf[1], MB_CUR_MAX > 1 ? "\302\240" : "\240");
# endif
return &stackbuf[1];
-# else
- return localeconv () -> thousands_sep;
# endif
}
# endif
(wchar_t) (unsigned long) nl_langinfo (_NL_NUMERIC_THOUSANDS_SEP_WC);
stackbuf[1] = L'\0';
return stackbuf;
+# elif defined _WIN32 && !defined __CYGWIN__
+ const char *tmp = localeconv () -> thousands_sep;
+ if (*tmp != '\0')
+ {
+ mbstate_t state;
+ mbszero (&state);
+ if ((int) mbrtowc (&stackbuf[0], tmp, strlen (tmp), &state) > 0)
+ stackbuf[1] = L'\0';
+ else
+ stackbuf[0] = L'\0';
+ }
+ else
+ stackbuf[0] = L'\0';
+ return stackbuf;
# elif defined __sun
/* Use sprintf, because swprintf retrieves a wrong value for the
thousands-separator wide character (e.g. (wchar_t) 0xffffffa0). */
dnl Solaris 11.4 . # . # # # # # . . # . . . # # . # . . . . . . . . . . # .
dnl Solaris 11.3 . # . . . # # # . . # . . . ? ? . . . . . . . . . . . . # .
dnl Solaris 11.0 . # . # # # # # . . # . . . ? ? . # . . . . . . . . . ? ? ?
-dnl Solaris 10 . # . # # # # # . . # . . . ? ? . # . # . . . . . . . . # .
+dnl Solaris 10 . # . # # # # # . . # . . . # # . # . # . . . . . . . . # .
dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . ? ? . # ? # . . . # . . . ? ? ?
dnl Solaris 2.5.1 # # . # # # # # # . # . . . ? ? . # ? . . # # # # # # ? ? ?
-dnl AIX 7.1 . # . # # # # # . . . . . . ? ? . # . # . . . . . . . # . .
+dnl AIX 7.1 . # . # # # # # . . . . . . . . . # . # . . . . . . . # . .
dnl AIX 5.2 . # . # # # # # . . . . . . ? ? . # ? . . . . . . . . # ? ?
dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . ? ? . # ? . . . . # . . . # ? ?
dnl HP-UX 11.31 . # . . . # # # . . . ? . . ? ? . # ? . . . . # # . . ? ? ?
# vasnprintf.m4
-# serial 55
+# serial 56
dnl Copyright (C) 2002-2004, 2006-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
[
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_INT_PRECISION])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_MULTIBYTE])
- case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in
- *yes,*yes)
- case "$gl_cv_func_printf_flag_grouping_int_precision" in
- *yes)
+ case "$host_os" in
+ mingw* | windows*)
+ dnl MSVC does not support the ' flag at all.
+ dnl mingw does not support it, unless __USE_MINGW_ANSI_STDIO is defined.
+ dnl mingw also has other bugs regarding the ' flag.
+ AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
+ [Define if the vasnprintf implementation needs special code for the
+ ' flag.])
+ ;;
+ *)
+ case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in
+ *yes,*yes)
+ case "$gl_cv_func_printf_flag_grouping_int_precision" in
+ *yes)
+ ;;
+ *)
+ AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1],
+ [Define if the vasnprintf implementation needs special code for the
+ ' flag, for integer directives only.])
+ ;;
+ esac
;;
*)
- AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1],
+ AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
[Define if the vasnprintf implementation needs special code for the
- ' flag, for integer directives only.])
+ ' flag.])
;;
esac
;;
- *)
- AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
- [Define if the vasnprintf implementation needs special code for the
- ' flag.])
- ;;
esac
])
size_t length;
char *result = asnprintf (NULL, &length, "%'.5g", 3141592653.5897932386);
ASSERT (result != NULL);
- ASSERT (length == 10);
- ASSERT (strcmp (result, "3,1416e+09") == 0);
+ #if defined _WIN32 && !defined __CYGWIN__
+ /* Native Windows uses 3 digits for the exponent. */
+ ASSERT (length == 11);
+ ASSERT (strcmp (result, "3,1416e+009") == 0);
+ #else
+ ASSERT (length == 10);
+ ASSERT (strcmp (result, "3,1416e+09") == 0);
+ #endif
free (result);
}
{
size_t length;
char *result = asnprintf (NULL, &length, "%'.5g", -3141592653.5897932386);
ASSERT (result != NULL);
- ASSERT (length == 11);
- ASSERT (strcmp (result, "-3,1416e+09") == 0);
+ #if defined _WIN32 && !defined __CYGWIN__
+ /* Native Windows uses 3 digits for the exponent. */
+ ASSERT (length == 12);
+ ASSERT (strcmp (result, "-3,1416e+009") == 0);
+ #else
+ ASSERT (length == 11);
+ ASSERT (strcmp (result, "-3,1416e+09") == 0);
+ #endif
free (result);
}
{
size_t length;
wchar_t *result = asnwprintf (NULL, &length, L"%'.5g", 3141592653.5897932386);
ASSERT (result != NULL);
- ASSERT (length == 10);
- ASSERT (wcscmp (result, L"3,1416e+09") == 0);
+ #if defined _WIN32 && !defined __CYGWIN__
+ /* Native Windows uses 3 digits for the exponent. */
+ ASSERT (length == 11);
+ ASSERT (wcscmp (result, L"3,1416e+009") == 0);
+ #else
+ ASSERT (length == 10);
+ ASSERT (wcscmp (result, L"3,1416e+09") == 0);
+ #endif
free (result);
}
{
size_t length;
wchar_t *result = asnwprintf (NULL, &length, L"%'.5g", -3141592653.5897932386);
ASSERT (result != NULL);
- ASSERT (length == 11);
- ASSERT (wcscmp (result, L"-3,1416e+09") == 0);
+ #if defined _WIN32 && !defined __CYGWIN__
+ /* Native Windows uses 3 digits for the exponent. */
+ ASSERT (length == 12);
+ ASSERT (wcscmp (result, L"-3,1416e+009") == 0);
+ #else
+ ASSERT (length == 11);
+ ASSERT (wcscmp (result, L"-3,1416e+09") == 0);
+ #endif
free (result);
}
{