Mateusz Loskot :: hacking on, working out, living up

Yet another argument for -Wall always on

24 Jul 2008 | mloskot

Yes, I’m religious about writing correct and standard C/C++ code and the decalogue of my religion tells do not ignore compiler warnings. Yet another pinch to the vast jar of examples is about getting detailed warning on mixed types in printf format specifiers:

#include <stdio .h> int main (void) { printf ("%d", 0.0); printf ("%lu", 0u); printf ("%lu", sizeof 0); return 0; }

Building the test above with following three commands will answer why it’s a good idea to help the compiler to help us:

Fork me on GitHub