Why does MinGW-w64 supports '%m$' notation in 'scanf', but not in 'printf'?

Viewed 46

In MinGW-w64, The %m$ can be used in the function scanf (__mingw_scanf). For example:

int a, b;
scanf ("%2$d%1$d", &a, &b);

When user inputs 1 2 at runtime then enter, the value of a is 2 and b is 1

But using %m$ in printf (__mingw_printf) is quite different. For example:

printf ("%2$d %1$d\n", 123, 456);

this statement does not contain any errors or warnings during compile and link process. In runtime, the result should be 456 123, but it actually prints %2$d %1$d in console window, regarding all characters in format string as ordinary characters.

Why does it happen in MinGW-w64?

0 Answers
Related