The format_arg function attribute provides a way to identify user-defined functions that modify format strings. Once the function is identified, calls to functions like printf, scanf, strftime, or strfmon, whose operands are a call to the user-defined function can be checked for errors.
where string_index is a constant integral expression that specifies which argument is the format string argument, starting from 1.format_arg function attribute syntax >>-__attribute__--((--+-format_arg-----+--(--string_index--)--))->< '-__format_arg__-'
For non-static
member functions in C++, string_index starts from 2 because
the first parameter is an implicit this parameter.extern char* my_dgettext(const char* my_format, const char* my_format2)
__attribute__((__format_arg__(1))) __attribute__((__format_arg__(2)));
printf(my_dgettext("%","%"));
//printf-style format diagnostics are performed on both "%" strings