J
jacob navia
I am implementing the POSIX enhancements to printf under lcc-win.
I had already implemented the ' modifier, that allows to group big
numbers sequences of 3 digits, i.e. instead of
File size is 633455543 bytes
to write
File size is 633 455 543 bytes.
MUCH more readable!
I am now starting to implement positional arguments
printf("%d %d %d\n", 1, 2, 3);
output:
1 2 3
printf("%3$d %2$d %1$d\n",1,2,3);
output:
3 2 1
These are really nice things to have, and it is a pity they aren't more
used. I tested the versions of gcc I have (linux Mint and Macintosh OS
X) and none of them implements that.
Anyone here has a compiler that implements those? How wide are the
implementations of that standard?
POSIX specs:
The Open Group Base Specifications Issue 7
IEEE Std 1003.1, 2013 Edition
I had already implemented the ' modifier, that allows to group big
numbers sequences of 3 digits, i.e. instead of
File size is 633455543 bytes
to write
File size is 633 455 543 bytes.
MUCH more readable!
I am now starting to implement positional arguments
printf("%d %d %d\n", 1, 2, 3);
output:
1 2 3
printf("%3$d %2$d %1$d\n",1,2,3);
output:
3 2 1
These are really nice things to have, and it is a pity they aren't more
used. I tested the versions of gcc I have (linux Mint and Macintosh OS
X) and none of them implements that.
Anyone here has a compiler that implements those? How wide are the
implementations of that standard?
POSIX specs:
The Open Group Base Specifications Issue 7
IEEE Std 1003.1, 2013 Edition