The use of "1$", "2$" et al in printf format specifiers is a
POSIX-specific feature.

On Cygwin (newlib) this is handled correctly in most cases, but one
example I tried misbehaves.
The output is correct on other implementations, including glibc and
musl on Ubuntu.

This C program:

#include <stdio.h>
int main(void) {
    long long a = 123456789876543210;
    double b=1.0/3;
    printf("a:%2$8.8lld b:%1$10.2g\n", b, a);
}

should produce this output:

a:123456789876543210 b:      0.33

Under Cygwin (fully updated), with "gcc c.c -o c && ./c", the output is:

a:140732550844138 b:  7.1e-315

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to