formatattribute lets you tell g++ that a function takes
printf-like arguments that should be type-checked against a format
const char*. (I won't say string, especially not since C++ has strings, even if it doesn't have string literals.)
You say which argument is the format
const char*, and which argument begins the list of arguments to be checked against. Arguments are numbered from 1.
Unless you're using the attribute on a member function.
Function Attributes - Using the GNU Compiler Collection (GCC) says: "Since non-static C++ methods have an implicit this argument, the arguments of such methods should be counted from two, not one".
Why? What's that got to do with anyone but the compiler writer? It's not like
thiscan be the format
const char*, so why do we need to pollute our code with this implementation detail of someone else's program?
I love the way it's presented, though. As if there's nothing they could have done about it. Why aren't all compilers as good as Jikes? Why don't more compiler writers take pride the user interface? Surely as developers themselves they feel this on a daily basis?