snprintf is partial on mingw

Lubomir I. Ivanov neolit123 at gmail.com
Mon Oct 14 06:13:26 UTC 2013


https://www.gnu.org/software/gnulib/manual/html_node/snprintf.html
"This function does not support format directives that access
arguments in an arbitrary order, such as "%2$s", on some platforms:
NetBSD 3.0, mingw, BeOS."

i'm a bit confused, didn't we have ordered lists in the GTK version,
like this one?
_("%1$s, %2$s %3$d, %4$d %5$02d:%6$02d"),

it could have been some sort of a hidden GLib overload...

but this small test.c does not work on WIndows 7 any more:
--------------------
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
char buffer[512];
if (buffer) {
snprintf(buffer, sizeof(buffer),
"%1$s, %2$s %3$d, %4$d %5$02d:%6$02d",
"monday",
"june",
4, 2001,
13, 37);
}
printf("%s\n", buffer);
return 1;
}
--------------------

would it be a problem if we move divelist.c:get_dive_date_string()
into qthelpers.cpp and use QString()::arg()?

lubomir
--


More information about the subsurface mailing list