diff --git a/.gitignore b/.gitignore index 891672d..6536776 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ multibrot-openmp multibrot-openmp.png hello-openmp mandelbrot-openmp +positional-format-strings diff --git a/Makefile b/Makefile index 977645f..5fddb7e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs \ ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom \ wo-lernen lua-foo binsearch test-inline-assembly uiowa-threads-example \ mtrace-test av-variance undefined-behaviour \ - multibrot-openmp hello-openmp mandelbrot-openmp + multibrot-openmp hello-openmp mandelbrot-openmp \ + positional-format-strings EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s tags \ mtrace-test.trace mtrace-test.txt multibrot-openmp.png VERYEXTRAS=cppcheck.txt diff --git a/positional-format-strings.c b/positional-format-strings.c new file mode 100644 index 0000000..1a6158d --- /dev/null +++ b/positional-format-strings.c @@ -0,0 +1,8 @@ +#include + +/* suppress "warning: positional arguments are not supported by ISO C" */ +#pragma GCC diagnostic ignored "-Wformat-non-iso" + +int main(void) { + printf("%3$3.2f %2$s %1$s\n", "One", "Two", 3.0); +}